Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Composition is used for aggregations where the life span of the member object depends on the life span of the aggregate. The aggregate not only has control over the behavior of the member, but also has control over the creation and destruction of the member. In other words, the member object cannot exist apart from the aggregate. This greater responsibility is why composition is sometimes referred to as strong aggregation. Figure 6-34 shows that composition is a subset of aggregation, just as aggregation is a subset of association.
Figure 6-34: How to model an aggregation relationship.
Draw this stronger form of aggregation simply by filling in the aggregation diamond. In Figure 6-35, the project team example uses aggregation, the hollow diamond; employees are assembled into a project team. But if the team is disbanded, the employees live on (depending, of course, on how well they performed on the project). The theater event example uses composition, the solid diamond; an event is composed of one or more performances. The performances would not continue to exist elsewhere on their own. If the event were deleted, the performances would cease to exist along with the event. In a database environment this is called cascading deletions.