image

Both aggregation and composition are special kinds of associations. They are used to represent ownership or a whole/part relationship.

But when should you use them? I am always confused and I have difficulties to remember which one to use when.

It is pretty simple though, composition is just a stronger relationship than aggregation.

An example will probably help. Henk and his brain have a composite relationship. If you destroy Henk, his brain will be non functional too. In fact, it is already pretty non functional since I have a hard time remember this composite relationship thing, but that is besides the point I am trying to make here.

On the other side, Henk and his blog have an aggregate relationship. If you destroy Henk, then his blog will survive. You could also call this a kind of stand-alone composite relationship.

Only we need now is a kind of mnemonic reminder!

Unfortunately, I cannot think of one…