Executable UML: A Foundation for Model-Driven Architecture

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

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

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

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

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.

Категории