OOPortal OOPortal

Problem Analysis  «Prev  Next»
 Lesson 11 Modeling aggregation Objective Understand and apply aggregation.

### Aggregation defined

An aggregate object is an object built from other objects. In addition, the aggregate object is greater than the sum of its parts. All interactions with this assembly of objects are performed through the aggregate object interface. The component objects are hidden or encapsulated within the aggregate.
Aggregation uses a diamond to describe the association instead of a verb.
A verb may be used, but usually the diamond is used without a verb for the association name.

Note that multiplicity is still required at both ends of the association.
Many modelers leave the multiplicity off the diamond/aggregate end, assuming a multiplicity of one.
Assuming is never a good option. There is no default value.

### Using aggregation

Aggregation is used for modeling both logical and physical assemblies. For example, a baseball team is a logical assembly. The coach and players work together as a unit. If the team is scheduled to play, then all the players and the coach are scheduled to play as a unit.
A car, however, is a physical assembly with a number of component parts working together as a unit. To move the car forward requires that the parts work together in a prescribed manner and as a unit.
A common characteristic of aggregates is that the parts may be changed over time. A team member may switch teams. An engine may be replaced in a car. Logical grouping and regrouping are common activities when working with aggregates. Changes in the parts imply the need to track the configuration of the aggregate object over time.

### How to identify aggregation

Watch for these key words and phrases in the problem statement:
1. Assembly
2. Part of
3. Consists of