Part-Whole Associations

Let’s learn about part-whole associations.

We'll cover the following...

A part-whole association is an association that represents a relationship between a part type and a whole type. Its instances are part-whole relationships between two objects, where one of them is a part of the other.

Aggregation

An aggregation is a special form of a part-whole association, where the parts of a whole can be shared with other wholes. For instance, we can model an aggregation between the classes DegreeProgram and Course, as shown in the following diagram, since a course is part of a degree program and can be shared among two or more degree programs For example, an engineering degree program can share a C programming course with a computer science degree program.

However, the concept of aggregation and shareable parts doesn’t mean much, so it doesn’t affect the implementation. As a result, many developers prefer not to use the white diamond in their class diagrams but instead model a plain association. The UML spec says that Precise semantics of shared aggregation varies by application area and ...