In Object Oriented Design:
What are Association, Aggregation, Composition, and Generalization?
How are these represented in Diagrams? Draw the diagrams.
Give examples of Association, Aggregation, Composition, and Generalization. Write some example skeleton classes in any OOP language.
What is the difference between Aggregation and composition?
What is the difference between Generalization and Specialization?
Ref: https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-aggregation-vs-composition/
Aggregation and Composition are subsets of association meaning they are specific cases of association. In both aggregation and composition object of one class “owns” object of another class. But there is a subtle difference:
- Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). Delete the Class and the Students still exist.
- Composition implies a relationship where the child cannot exist independent of the parent. Example: House (parent) and Room (child). Rooms don’t exist separate to a House.
“Generalization is a mechanism for combining similar classes of objects into a single, more general class.”
“Specialization is the reverse process of Generalization means creating new sub-classes from an existing class.”