In many cases, we find associations that give rise to additional classes. Usually these additional classes have attributes to capture data that's not properly part of either of the two participating classes. Figure 6.8 shows how to model the association with a third class, an association class, and place the attributes there. Figure 6.8. The Association Class ProductSelectionDefinition: An association class is an abstraction, as a class, of an association that may have its own attributes, other associations, and behavior.
The instances of the association class are the links between the participating objects. An association class is therefore a class whose instances come into existence when an association between the two principal instances is created. The instance of the association class is deleted when the two principal instances are unrelated. Definition: A link object is an instance of an association class. Association classes carry attributes.An association class carries attributes that describe the association itself, as shown in Figure 6.9. Figure 6.9. Association Class AttributesAssociations to association classes.An association class can participate in associations. Figure 6.10 shows how the Book Purchase is paid for by a Credit Card Charge. Figure 6.10. Associations to an Association ClassAssociation classes for behavior.We will also see association classes that exist to model the behavior of associations, especially contention. We take up this topic in Chapter 13: Relationship Dynamics. |