What is an association class?
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.
Here are some pointers to consider when modeling with association classes:
- You cant attach the same class to more than one association; an association class is the association.
- The name of the association is usually omitted since it is considered to be the same as that of the attached class.
- 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.