6.4 Association Classes


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 ProductSelection

graphics/06fig08.gif

Definition: An association class is an abstraction, as a class, of an association that may have its own attributes, other associations, and behavior.

graphics/exclamation.gif

Strictly speaking, an association class is a reification, not an abstraction. An association is already an abstraction of its links. An association class creates a first-class entity where one did not previously exist, which is reification.

"Reification" means roughly "to make into a thing." Our definition avoids introducing yet another term.

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 Attributes

graphics/06fig09.gif

Associations 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 Class

graphics/06fig10.gif

Association 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.



Executable UML. A Foundation for Model-Driven Architecture
Executable UML: A Foundation for Model-Driven Architecture
ISBN: 0201748045
EAN: 2147483647
Year: 2001
Pages: 161

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