Can one object to belong to two composites?

Are the class diagram and are faced with the question: can one object to belong to multiple composites(aggregates)

For example, there are classes Comment, Article, Movie, Like
5e26ffa16d1ca839628210.png

The laughter can be seen that Like is part of the three objects, and the logic Like for each object your.

True if the diagram? Or should I replace the usual Association?
How to display this relationship on the graph?

Tell me or share the source where to read.
April 4th 20 at 13:12
1 answer
April 4th 20 at 13:14
can one object to belong to multiple composites(aggregates)
Formally, UML does not prohibit it, so that you can.
The laughter can be seen that Like is part of the three objects
- The relation part-whole is aggregation. Shows you the composition: a like instance of a class can exist ONLY within instances of these three classes. Comment destroyed - destroyed is like
Or should I replace the usual Association?
Well, it is important to understand the business context of the subject area and use likes and what you want from this chart.

Martin Fowler.UML. The basics, 3rd edition
UML. The user's guide.Gradi Buch, James Rumbaugh
can one object to belong to multiple composites(aggregates)
Formally, UML does not prohibit it, so that you can.


And the concept of aggregation and composition have no such restrictions? - gage61 commented on April 4th 20 at 13:17
@gage61, the concept composition and aggregation in the context of a specific UML notation (read PLO) does not prohibit this. Implemented so likes in all social networks : when I delete your comment, which perlican removed and all likes, and do not stay on the page or in some sort of "piggy likes" - Katheryn.Gusikowski35 commented on April 4th 20 at 13:20

Find more questions by tags Designing software