I am having trouble finding the right and easiest answer to the above question. Can you please answer my question. There are many kind of answers to association Vs Composition Vs Aggregation.
1 Answers
One is plain and one is hollow ;-)
Indeed, the UML specifications let the semantics of aggregation very hollow, that is unspecified. More precisely, page 112 of UML 2.5.1 about ("shared") aggregation and composition ("composite aggregation") says:
Shared: Indicates that the Property has shared aggregation semantics. Precise semantics of shared aggregation varies by application area and modeler.
Composite: Indicates that the Property is aggregated compositely, i.e., the composite object has responsibility for the existence and storage of the composed objects.
Jame Rumbaugh, one of the UML founder even called aggregation a “modeling placebo”, i.e. some feel better when using it even if it does not add any useful information (the exact quote here)
P.S: you will find lots of misinformation on aggregation. Including the most voted question on SO about it. But it's not a question of belief. UML is a standard (even an ISO standard), so always verify that claims are backed by authoritative references

- 68,716
- 7
- 72
- 138
-
There are already so many answers on this question here on SO. And unfortuntely many of them are incorrect and/or outdated... (well, yours isn't but its just one more fish in the pond) I wonder how we could get some out and have them roasted over the fire. – qwerty_so Oct 20 '22 at 20:18
-
@qwerty_so the problem with that question is that 1) aggregation was always controversed; 2) UML evolved on the definition; 3) the highly voted question on SO about these differences ages and is full on wrong answers that are highly voted. The only way out is to provide a right answer instead to send to the wrong place. With time passing and search algorithms favouring newer content, I have hope that some day, from a probabilistic point of view, readers will have at least as much chances to get a right answer than a wrong one ;-) – Christophe Oct 21 '22 at 06:18
-
So I closed in in favor of a newer existing answer and not that swamp one. Honestly, I don't know how to solve that except SO itself will get aware of it (IIRC they were aware but nothing happened so far) – qwerty_so Oct 21 '22 at 14:57
-
1@qwerty_so no problem, although this one is more general and reusable, and the selected answer on the dupe is not the clearest one. At least i could uv our very knowledgeable friend Gerd :-) – Christophe Oct 21 '22 at 17:51