Yes, a ternary association is a possibility. But think of it twice, because many people have difficulties reading ternary associations with hight multiplicity on one branch only.
There are plenty of ways to model the relationship between an email, a sender, and multiple receivers. There is no single good answer. For example:
Senderif you’d see each sender or receiver as an embedded value object within the emails (so two emails with the same sender address would each have its own copy of the object).
- A ternary association as you have modelled it,
- Not to speak of the case were you would have
Receiversbeign composed with or inheriting from a common denominator
The question is how you want to see all these elements, i.e. your understanding of the world. For example:
Senderor is it the
- can an
Receiver? I often start to write an email and add the receivers later on (to avoid sending it by accident). If the answer is yes, you elminiate the association class.
Receiverreally part of your system? If no, why is there a
read()opeartion? If yes, what’s the benefit of having a single system email system ?
- how easy do you think the concept of ternary association is to grasp for your readers, whent tehre is a higher multiplicity on one end?
And this leads to the question of what your system really do with emails. It would be a pitty to model complex relationships with
Receivers if in the end those are not needed, because you have just to develop an MTA that needs to get the
Receivers from an email and make some queries to forward the email to the correct IP addresses.
Maybe a good start for your modeling could therefore be RFC 5322 which explains that senders and receivers are in fact only email addresses, which would lead to a simplified model with an
Address class, and two associations (one with end
to and the other with end
from) between the same classes.
CLICK HERE to find out more related problems solutions.