Some books describe it as a 1:m association between classes A and B with an implied 0..1 label at the diamond end, while others see it as a 1:1, 1:m or m:n whole-part association. Which one is correct?
Thanks!
Some books describe it as a 1:m association between classes A and B with an implied 0..1 label at the diamond end, while others see it as a 1:1, 1:m or m:n whole-part association. Which one is correct?
Thanks!
All versions are correct, they key of aggregation is not cardinality (1:1, 1:m or m:n) it can has anyone of these you mentioned.
The key is that even when e.g. an instance of B is in an instance of A, if you destroys A, B remains.
e.g.: A company has clients and clients will still existing when company disappears (aggregation) but employees won't to be employees when company disappears (composition).
Not my best analogy but representative enough I guess.
It's like in databases and for me this view is more clear, a table with a foreign key will be aggregation and relational 3rd table is composition.