jargon

Comparison

AggregationvsComposition

Aggregation

Two shades of has-a: composition means the part's lifetime is owned by the whole and it cannot be shared, aggregation means the whole merely holds a reference to something that outlives it.

Composition

The distinction is drawn as a filled or hollow diamond in UML and is worth exactly as much as the lifetime consequence — what gets deleted, what gets copied, what can be handed to two owners at once.

The difference

Two shades of has-a: composition means the part's lifetime is owned by the whole and it cannot be shared, aggregation means the whole merely holds a reference to something that outlives it. The distinction is drawn as a filled or hollow diamond in UML and is worth exactly as much as the lifetime consequence — what gets deleted, what gets copied, what can be handed to two owners at once. It becomes concrete rather than academic the moment you write a delete or a deep copy.

Entry: Aggregation vs composition

Related comparisons