Reputation: 73
I have three classes:
-User class
-Role class
-UserRole class : to join both classes
Each user can have multiple roles.
So, I made this class diagram:
Is the composition relationship between classes and the cardinalities correct?
Upvotes: 0
Views: 134
Reputation: 36295
You can safely omit the composition diamonds as they add no real semantic to the model. Compositions are used on a metaphoric level and are more food for philosophers than anyone else.
Now for the multiplicities. A UserRole binds exactly one user to one role. You can have multiple UserRoles to reflect different roles for single or multiple users. So you should place a 1
to the left and right multiplicities.
Upvotes: 1
Reputation: 6529
No. When the relationship goes away, you don't want the other things to get deleted. The pointy ends must also be 1's.
Upvotes: 1