What is Generalization?
The process of extracting common characteristics from two or more classes and combining them into a generalized superclass is called Generalization. The common characteristics can be attributes or methods.
The Generalization is the process that does the grouping entities into broader or distributed categories based on certain common attributes. All the common attributes bind together to form a higher-level component or element is called a generalized entity. The two different types of entities in a university's database, for example, can be Students and Professors where the students come under the professor entity.
Generalization is represented by a triangle followed by a line.
What is Specialization?
Specialization is the reverse process of Generalization means creating new subclasses from an existing class.
Specialization is the process of dividing a parent-level entity into narrower categories accordingly to all the possible child categories. By having the behavior of the opposite of the generalization process, specialization requires the separation of entities based on certain uncommon attributes.
Specialization is quite useful in a situation where you block out the unnecessary data so you can locate or identify the specific information whenever it requires. specialized kinds of entities can be specialized further due to the higher chance of further modularity.
Let’s take an example of a Bank Account; A Bank Account is of two types – A current Account and Saving Account. Current Account and Saving Account inherits the common/ generalized properties like Account Number, Account Balance, etc. from a Bank Account and also have their own specialized properties like interest rate, etc.
The difference between the Generalization vs Specialization
- Generalization works in a bottom-up manner while the specialized works complete ever than the generalization where it follows the top-down approach
- The entity of the higher-level must always have the lower-level entity in Generalization whereas, in Specialization, the entities of the top-level may not consist of the entities of the lower level periodically
- Generalization can be defined as a process where the grouping is created from multiple entity sets, and the Specialization takes a sub-set of the higher level entity and it formulates a lower-level entity set
- Generalization helps to reduce the schema of the data by unifying the multiple components. and in Specialization, it expands the schema by multiplying the multiple components
- Generalization leads to a reduction in the overall size of a schema and focuses on the specialization, on the other side, Specialization increase the size of schemas
What do you think?
In this article, I try to explain the Difference Between Generalization and Specialization. I hope you will enjoy the tips while programming with OOPs. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.