Types of Aggregation - Composite Aggregation vs Shared Aggregation
Articles by Bala Paranj
Aggregation models a whole-part relationship between things. The whole is called the composite.
There are two types of aggregation:
1. Composite aggregation
2. Shared aggregation
Composite aggregation specifies that the existence of the part is dependent on the whole. If the multiplicity at the composite end is
exactly one, the part has no existence separate from the whole. An example is a piston within an engine. If the multiplicity is exactly
one, the piston can be removed from the engine, but must immediately be installed in another engine. It cannot exist outside of an engine. If the multiplicity at the composite end is optional (0..1), the piston can be removed from the engine and placed on the spare parts shelf.
Composite aggregation is specified with a filled diamond.
Shared aggregation specifies that the multiplicity at the composite end may be more than one. The part may be simultaneously in many
composite instances. Shared aggregation is specified with a hollow diamond.
Notice how the lifetime differs in these two types of aggregation.
OOAD skills for the real world projects
Study Guide - Object Oriented Analysis and Design with UML