What is an association class?

John Moore

An association class is used to model an association as a class. Association classes often occur in many-to-one and many-to-many associations where the association itself has attributes.

As an example, consider a many-to-many association between classes Person and Company. The association could have properties; e.g., salary, jobClassification, startDate, etc. In this case, the association is more correctly modeled as an association class with attributes rather than trying to fold the attributes into one of the classes in the association.

An association class is rendered by a dashed line from the association to the class rectangle. Each link in the association is an object of the association class. An association class is essentially a class attached to an association; the association itself is modeled as a class.

Here are some pointers to consider when modeling with association classes:

  1. You can’t attach the same class to more than one association; an association class is the association.
  2. The name of the association is usually omitted since it is considered to be the same as that of the attached class.
  3. Distinguish between the use of an association class as a modeling technique and the implementation of the association class. There can be several ways to implement an association class.