How the N-ary association works in class diagram?

1.4k Views Asked by At
  • i have three classes and each one of them has an association with same forth class, is it okey to use N-ary association in this case ?
1

There are 1 best solutions below

0
muszeo On

It depends on the logic of your domain. If each of the three classes has a logically separate relationship with the fourth class (i.e. they can vary independently) then they are separate associations. If they are all associated by the same relationship then this would be N-ary. For example, a Car, Driver and Route could be all associated one relationship -- that you might call Journey -- which would be three-ended (N-ary), whereas a Car and an aggregate part (e.g. Wheel) would be two-ended. So it depends.