Aggregation vs Composition

0 Comments

Aggregation:
It represents a Has-A relation. Its a one way relationship which means that a departments can have multiple students but a student cant belong to multiple departments.
Also in aggregation both the entities can exists independently which means that they are not dependent on each other, ending one entity will not effect the other entity.

Composition:

It is a relation in which both the entities are highly dependent on each other. It represents a part-of relationship. When there is a composition between two entities, the composed object cannot exist without the other entity.

Aggregation vs Composition

Dependency: Aggregation implies a relationship where the child can exist independently of the parent. For example, Bank and Employee, delete the Bank and the Employee still exist. whereas Composition implies a relationship where the child cannot exist independent of the parent. Example: Human and heart, heart don’t exist separate to a Human

Type of Relationship: Aggregation relation is “has-a” and composition is “part-of” relation.
Type of association: Composition is a strong Association whereas Aggregation is a weak Association.


Leave a Reply

Your email address will not be published. Required fields are marked *