I am having a hard time actually finding the difference between a Generalization and a Specialization, and when to use either one.
Can anyone enlighten me?
Eventually also an illustration using UML
Animal is a generalization , Dog is specialization. Your superclass is a generalized class , but your subclass will be a specialized inheritor of your superclass. It becomes more specialized and less generalized as you move down the inheritance hierarchy .
Generalization is the process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. Shared characteristics can be attributes, associations, or methods.
If some new subclasses are created from an existing superclass to do specific job of the superclass, then it is known as specialization.
You can get more clear tutorial with UML diagrams here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With