Association vs Aggregation vs Composition
When a classes interacts with another class, a relationship develops between those two. This is called association. In an university, a student can learn from an instructor. We can model this relationship as follows.
The relationship can also show how many objects interact. This is called multiplicity. A student can learn from one or more instructors.
The relationship can also be bidirectional. An instructor can teach 1 or more students.
Association has two specific cases. Sometimes the relationship is modeled as a parent-child relationship(has-a relationship).
When a class can exist as part of another class, e.g. a hand is a part of person or an engine is a part of a car. The lifetime depends on the relationship. If the child can exist without the parent, we call it aggregation. If the child’s existence is dependent on the parent, we can it composition.