Answer the question
In order to leave comments, you need to log in
Can one object belong to two composites?
I am compiling a class diagram and faced the question: can one object belong to several composites (aggregates).
For example, there are classes Comment, Article, Movie, Like.
It can be seen from laughter that Like is part of three objects, and according to the Like logic, each object has its own.
Is the diagram correct? Or should it be replaced with a regular association?
How to display this relationship on the diagram?
Tell me or share a source where to read.
Answer the question
In order to leave comments, you need to log in
can one object belong to several composites (aggregates)Formally, the UML does not forbid this, so you can.
You can see from the laugh that Like is part of three objects- The part-whole relation is an aggregation. You have a composition: an instance of the like class can ONLY exist inside instances of these three classes. Destroyed comment - Destroyed and like
Or should it be replaced with a regular association?Well, here it is important to understand the business context of the subject area and the use cases for likes and what you want to get from such a diagram.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question