Generalization is a mechanism for combining similar classes of objects into a single, more general class. Generalization is a bottom-up process. Generalization and inheritance are powerful abstractions for sharing similarities among classes while preserving their differences.
Generalization identifies commonalities among a set of entities. The commonality may be of attributes, behavior, or both. Generalization/Specialization represents the is a relationship set , an essential element of the object oriented paradigm. The main idea in Generalization/Specialization is that one object class (the specialization) is a subset of another (the generalization). The direction of the is-a relationship goes from the specialization to the generalization, that is, it may be stated as, "Specialization Class is-a Generalization Class."
It indicates that a superclass (generalization class) and subclass
(specialization class) have common attributes, operations, and relationships.
A superclass has the most general attributes, operations, and relationships
that may be shared with subclasses. A subclass is a specialization
of a superclass. A subclass may have more specialized attributes and
operations. For example, a Shape superclass defines common attributes,
operations, and relationships for a square, circle , and triangle,
subclasses.
Some Forms of Generalization
1. Hierarchy: In the case of hierarchy, the commonalities are organized into a tree structured form. At the root of any subtree are found all the attributes and behavior common to all of the descendents of that root.
2. Genericity: In this case, the commonality is expressed with the aid of a parameter. Various specializations are distinguished by what they provide for the parameter. For example, using genericity it is possible to represent the common properties of a "stack" through the generalization of a "stack of anything", where "anything" represents the parameter.
3. Polymorphism: Polymorphism captures commonality in algorithms. Polymorphism allows the nested logic (or case statement) to be collapsed to a single case in which the different object types are treated in a uniform manner.
4. Patterns: A pattern expresses a general solution (the key components and relationships) to a commonly occurring design problem. The attributes and behavior of the individual components are only partially defined to allow the pattern to be interpreted and applied to a wide range of situations.