Problem Analysis  «Prev  Next»
Lesson 14Modeling advanced associations
ObjectiveApply association classes, qualified and reflexive Associations

Modeling Advanced Associations

Reflexive association

Apply association classes, qualified associations, and reflexive associations.
The reflexive association is used when objects in the same class can be associated. The entire association notation remains the same, except that the association line is drawn to and from the same class. Both examples below are equivalent expressions; one uses roles, whereas the other uses an association name.

Reflexive associations

Association class

Association classes are used to identify information about an association. The information is placed in a class attached to the association that it describes by a dashed line.

Association class

Be on the lookout for association classes when you see a multiplicity of more than one used on both ends of the association.


  1. Examine many to many associations. "Is there information about the links that we need in the association?"
  2. Identify the information that you need to track.
  3. Place the information in a class definition
  4. Attach the new class to the association using a dashed line.
  5. To implement the class you might later need to promote it to the status of a regular class
  6. Name and redefine the multiplicity of the new association.
  7. Repeat the process for the association between the association class and the other original class.
  8. Delete the original association that has now been completely replaced.

Domain Driven Design
Many-to-many Associations
Qualified associations provide the same functionality as indexes. The notation has a bit of a twist, so pay attention.
To indicate that a customer can look up an order using the order's ordernumber attribute, the ordernumber attribute name is placed in a rectangular box on the Customer end of the association. All the other association notation remains intact but is pushed out to the edge of the rectangle. Because the qualifier is an attribute, it may include a data type.

Qualified association 1) Without the qualifier 2) With the qualifier

Use qualifiers to reduce the multiplicity in the same way you would use indexes in a database.
Note in the example how the multiplicity for Order changed from 0..* to 1 because the qualifier provided a unique key for Order.
Qualifiers Reduce Multiplicity

Modeling Assocation Exercise

Click the Exercise link below to model advanced associations from the course project.
Modeling Assocation - Exercise