Difference between composition and aggregation

Site Under Maintenance - Tutorialspoint

Error. We can’t find the page you’re looking for.

Sorry for the inconvenience. Go to our homepage or check out our Latest Courses, eBooks, Prime Packs...

Back to Home

Composition and aggregation are two types of association which is used to represent relationships between two classes. 

In Aggregation , parent and child entity maintain Has-A relationship but both can also exist independently. We can use parent and child entity independently. Any modification in the parent entity will not impact the child entity or vice versa. In the UML diagram, aggregation is denoted by an empty diamond, which shows their obvious difference in terms of strength of the relationship.

In Composition, parent owns child entity so child entity can’t exist without parent entity. We can’t directly or independently access child entity. In the UML diagram, composition is denoted by a filled diamond. 

Sr. No.KeyCompositionAggregation



Composition(mixture) is a way to wrap simple objects or data types into a single unit

Aggregation(collection) differs from ordinary composition in that it does not imply ownership



In composition , parent entity owns child entity.

In Aggregation , parent Has-A relationship with child entity


UML Notation 

It is denoted by a filled diamond. 

It is denoted by an empty diamond. 


Life cycle 

Child doesn’t have their own life time 

Child can have their own life time 



It is a strong association 

It is a weak association 

Updated on 21-Jan-2020 07:44:28