Let's say we have a supermarket chain and a number of supermarkets belong to it.
If the chain ceases to exist the supermarkets will have to shut down. This could be implemented in UML using a composition relationship. On what side of the association should the filled-in diamond be located?
Chain----<.>supermarket
? Or chain<.>-----supermarket
) ? In UML, you put the composition diamond next to the class that composes another. In your example, An individual of type Chain
composes [1] several individuals of type Supermarket
, so the black diamond goes on the Chain
end of the association.
[1] Some people pronounce this "Chain
has Supermarkets
", which is indistinguishable from a different sense of the word "has", as in "Chain
has name
".