Skip to main content

Aggregation (UML)

An Aggregation is a form of an Association with extended notation to emphasize on whole/part-relationships.

Figure 1 The DiningTable denotes the whole, and 4 Chairs are its part.

An Aggregation between entities can be illustrated in UML with a blank rhombus starting at the root of the Aggregate, then connecting to the supplier(s) of the aggregate with a solid line. An Aggregation can also use Multiplicity, and Navigability. It should be noted that with Aggregates, the association parts of such a construct are always navigable. If the owner of the Aggregate is navigable, an open Arrow Head ending at the solid line connecting to the rhombus can be used.

Whereas an Association already depicts the relationship between elements, an Aggregation enhances this with providing a visual clue on the whole/part-relationship, using the rhombus with the root of the "whole", the aggregate root.

Aggregation vs. Association

Despite the visual clue in form of the rhombus to delineate a whole/part-relationship, Aggregations provide no significant advantage over using Associations. In [📖UML, p. 68], Martin Fowler writes:

"Aggregation is strictly meaningless; as a result, I recommend that you ignore it in your own diagrams."

following Rumbaugh et al.:

"The distinction between aggregation and association is often a matter of taste rather than a difference in semantics.[...] Think of it as a modelling Placebo." [📖UREF, p. 148]

tip

A Composition can be used as a stronger form of Aggregation when the lifetime of parts should be tied to the lifetime of the owning object.

Aggregates in DDD

Aggregates have particular meaning in DDD, where they are units representing business objects in a Domain Model. Within their limits, technical invariants apply, and they are identifiable given an Aggregate Root. Their state can be persisted and reconstituted.