In: Computer Science
*******************************************************************************************************************************
Explanation of Generalization versus Specialization in Object Oriented Context --
Generalization - It is the technique of extracting shared properties or characterestics from two or more classes, and combining them into a generalized super-class. Here all the sub-classes are basically types of super-class. Therefore we can conclude a subclass “is-A” super-class and is termed as “is-A relationship”.
Specialization - It states creating new sub-classes from an existing class. If seen that certain attributes or methods only apply to some of the objects of the class then a subclass can be created. In one sentence we can say that the conversion of a super class type into a sub class type is termed as specialization.
For an example -
Let's understand Dog is-a mammal, by this we understand that Dog is a specialized kind of mammal. It bears all the features of any mammal (features like - nurses with milk, has hair), but it specializes these features to the familiar characteristics of canine domesticus.
A Cat is also a mammal. So, if we go by that then we expect it to share certain features with the Dog that are generalized in Mammal, but to distinguish in those features that are specialized in Cat.
By this example we should conclude that specialization and generalization relationships are very much reciprocal and hierarchical. They tend to be reciprocal because specialization is opposite side of the coin from generalization. Henceforth, both Dog and Cat do specialize Mammal. And Mammal generalizes from Dog and Cat. This is how they are related.
********************************************************************************************************************************
Hope this clears up your concept. Thanks ! :-)