Difference Between Aggregation and Composition

Computer ProgrammingProgrammingMiscellaneous

In this post, we will understand the difference between Aggregation and Composition.

Composition

  • It tells about a mixture.

  • It is a way to wrap the simple objects/data types into a single unit.

  • It is considered as a strong association.

  • A parent entity owns a child entity.

  • The child entity doesn’t have its own lifetime.

  • It is represented using a diamond that is filled.

Aggregation

  • It tells about a collection.

  • It is different from ordinary composition.

  • It doesn’t imply any ownership.

  • It is considered as a weak association.

  • In this, the parent entity has a ‘HAS – A’ relationship with the child entity.

  • It is represented using a diamond that is empty.

raja
Published on 23-Mar-2021 08:03:08
Advertisements