2

I have two classes: User and Event. The user can:

  • Create an event.
  • Comment on an event.

enter image description here

I want to know if I can create more than one association between event and user? Thank you for any references.

2 Answers 2

1

You can create as many associations between classes as you need. There is no limit. You should add association-end names to clarify the purpose of each association, since without them the model will just not make much sense.

However, in your example you have one association class and a normal association. That could go without association ends.

2
  • The association end names are really important. Without them there are no properties to navigate across the association. UML does not generate default names for these (even though there is a non-normative sentence about this for the spec itself).
    – Jim L.
    May 12, 2016 at 14:19
  • 1
    @JimL. Thanks for the correction. And yes, the names should not be left out since they add a lot of semantics to the model.
    – qwerty_so
    May 12, 2016 at 14:24
0

I agree with Thomas. You can create as many associations between classes as you need. You should also use association-end names to clarify your model and provide properties to navigate across the association.

Moreover, you should consider making a Comment a normal class in its own right, so you can add the semantics of made by one User and made about one Event. The way you have it modeled, you disallow multiple Comments from one User on one Event. Why would you want that?

5
  • Actually the Comment association class is just a class sitting between the two linked classes allowing to allow many relations.
    – qwerty_so
    May 12, 2016 at 17:49
  • It's not equivalent. The multiplicity from the other classes can have more specificity.
    – Jim L.
    May 12, 2016 at 17:53
  • Uhm. I think the 1 at the User side here make this association class pointless. But generally an AC is a class sitting between 2 (or more) other classes establishing a n-m relation.
    – qwerty_so
    May 12, 2016 at 18:06
  • I don't understand your point. Do you agree that the assn class, as it is, makes it impossible to have multiple comments for the same event?
    – Jim L.
    May 13, 2016 at 0:04
  • Yes. I agree. I was talking about assn class in general. Seems we were cross talking again ;-)
    – qwerty_so
    May 13, 2016 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.