Aggregation: Life After Death or Not?

I've read several articles on Stack Overflow about aggreation and how it compares to delegation and composition. Mainly:

distinguish between delegation, composition and aggregation (Java design design)

According to this and other articles I've read here, the concession is that aggregation is that one object belongs to another, however, the death of one does not mean the death of the other. However, according to the GoF design patterns:

"Aggregation implies that the aggregate object and its owner have the same lifespan" [p. 22 below]

Any advice on this?

thank

+2


source to share


1 answer


I have seen both types of definitions, but installed:

  • composition implies a joint life
  • Aggregation implies no shared lifetime


IIRC that the meaning is used in the UML.

+5


source







All Articles