Showing What Can Be Shared: Aggregation


There are times when you want to show that a part can be shared among more than one aggregate. This is known as the weak form of aggregation. A part such as a computer can be shared among different networks at different times. The part’s life is not strongly tied to the life of the whole. The computer as part of the network maintains a separate existence from that of the network. You don’t fill in the diamond in the case of this weaker form of aggregation.

Remember The relationship between a class playing the role of the whole and its parts in known as aggregation. When the life of the parts are tied up in the life of the whole, then you call the aggregation relationship composition. When a part is sharable among different wholes, then you simply call the aggregation relationship aggregation.

Figure 5-2 uses the weak form of aggregation to model a common business object called SalesRegion. A sales region contains one or more offices, may or may not contain a wholesale warehouse, and does contain one or more retail outlets. Here the SalesRegion class is playing the role of the whole. Nevertheless, the association is not a composition because the parts are not necessarily destroyed if the sales region goes away.

Here’s a closer look at the multiplicity in the direction from the parts to the whole: An office is contained within zero or more sales regions, which means some offices belong to more than one sales region at the same time. A single wholesale warehouse services zero or more sales regions. A retail outlet belongs to at least one or more sales regions. The respective parts are potentially shared among sales regions.




UML 2 for Dummies
UML 2 For Dummies
ISBN: 0764526146
EAN: 2147483647
Year: 2006
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net