Visual Modeling with Rational Rose 2002 and UML (3rd Edition)

I l @ ve RuBoard

An aggregation relationship is a specialized form of association in which a whole is related to its part(s). Aggregation is known as a "part-of" or containment relationship. The UML notation for an aggregation relationship is an association with a diamond next to the class denoting the aggregate (whole), as shown in Figure 6-3.

Figure 6-3. UML Notation for an Aggregation Relationship

The following tests may be used to determine if an association should be an aggregation:

  • Is the phrase "part of" used to describe the relationship?

  • Are some operations on the whole automatically applied to its parts ? For example, delete a course then delete all of its course offerings.

  • Is there an intrinsic asymmetry to the relationship where one class is subordinate to the other?

For example, a Course (Math 101) may be offered at different times during a semester. Each offering is represented as a Course Offering (e.g., Math 101, Section 1, and Math 101, Section 2). The relationship between a Course and a CourseOffering is modeled as an aggregationa Course "has" CourseOfferings.

CREATING AN AGGREGATION RELATIONSHIP IN RATIONAL ROSE

  1. Select the Aggregation icon from the toolbar. The Aggregation icon may be added to the toolbar by right-clicking on the toolbar and selecting the Customize menu command.

  2. Click on the class playing the role of the "whole" in a class diagram and drag the aggregation line to the class playing the role of the "part."

An aggregation relationship is shown in Figure 6-4.

Figure 6-4. Aggregation Relationship

I l @ ve RuBoard

Категории