Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid circular association (Class Diagram)

I have a Project class that has one Objective. an Objective that has many Projects. a Meeting that can be associated to a Project (which has an Objective) or Objective. How can I represent this relationship in a Class Diagram

I know it shouldn't be done this way I know it shouldn't be done this way

like image 858
foulene Avatar asked Jan 21 '26 14:01

foulene


1 Answers

There is absolutely no problem in UML with circular associations. This is common business as soon as you model real life domains. You could even have self-associating classes in a circular association, and it still wouldn't be an issue.

Your only modelling challenge is to represent accurately:

A Meeting that can be associated to a Project (which has an Objective) or Objective.

You must therefore first disambiguate:

  • can it be none of the two (your diagram gets it) ?
  • can it be both? If yes:
    • can the meeting's objective be different from the project objective (your diagram still gets it) ?
    • or shall objectives of the meeting and the project be aligned (see my other answer here, how to express constraints between direct and indirect associated classes using OCL)
  • must it be the one or the other but not both (see this question for the best recent answers on this topic)?
like image 83
Christophe Avatar answered Jan 24 '26 13:01

Christophe