Reputation: 75
There are 2 classes in the scenario under consideration, User and ConnectionRequest.
The structures of the 2 classes are given below:
A user can send a connection request to another user, or they can receive a connection request from another user such as on social media platforms.
What type of connection/relation do the 2 classes share?
How can this be represented using UML notations in a class diagram?
Any modifications or improvements to the above model ignoring other system requirements are welcome.
Upvotes: 2
Views: 97
Reputation: 73446
This is tricky. If one user sends/receives a connection request to another user, but you want to use only one association, you’ll have a ternary association, with two ends for the same class User
(once for the sender role, once for the receiver role) and one for the ConnectionRequest
.
Alternative models could use either an association class ConnectonRequest
of User
to User
, or two distinct association between User
and ConnectionRequest
each with a different set of roles. at both ends.
Upvotes: 1
Reputation: 6529
Change the type of sender and receiver from String to User, using two associations.
Upvotes: 1