Is your UML Composition French or American?

The French Way
In many French books/lessons (a lesson here, another from caen university , one from UQAM), UML composition does not seem to mean the same as their English counterparts. They write:

Si l’agrégat est détruit (ou copié), ses composants le sont aussi.
or
les composants (en tant qu’ils sont composants) ont une durée de vie incluse dans celle de leur composé.

translated to English:
If the aggregate is destroyed (or copied), its components are destroyed (or copied) as well.
or
components (while they are components) lifetime is included in the one of their aggregate

But then what does it mean to have a cardinality of 0 on the aggregate side?
Few French lessons give an answer (UQAM does, maybe because it’s half French only). The component can be created before the aggregate but must be destroyed when the aggregate is.

The American Way

Most English books/lessons describe composition more accurately. Ootips definition is simple and clear:
Composition […] is exactly like Aggregation except that the lifetime of the ‘part’ is controlled by the ‘whole’. This control may be direct or transitive. That is, the ‘whole’ may take direct responsibility for creating or destroying the ‘part’, or it may accept an already created part, and later pass it on to some other whole that assumes responsibility for it.

However Martin Fowler in UML distilled explicitly writes:
The “no sharing” rule is the key to composition . Another assumption is that if you delete the polygon, it should automatically ensure that any owned Points also are deleted .

By using the word “assumption” he is avoiding a clear meaning. So I looked up in the UML specifications from uml.org. The specs are actually very near ootips definition and even more explicit:
An association may represent a composite aggregation (i.e., a whole/part relationship). Only binary associations can be aggregations. Composite aggregation is a strong form of aggregation that requires a part instance be included in at most one composite at a time. If a composite is deleted, all of its parts are normally deleted with it. Note that a part can (where allowed) be removed from a composite before the composite is deleted, and thus not be deleted as part of the composite. Compositions define transitive asymmetric relationships—their links form a directed, acyclic graph.

So it turns out that some French definitions were not wrong, but imprecise. Their true meaning becomes only clear after reading the English UML specs.

Ootips has also a good example of difference between aggregation and association. If you have an aggregation relation between two Node entities, it means you represent a tree of Nodes, not a graph of Nodes. See the link for more details.

comments powered by Disqus
Tweet Submit to reddit
© 2006-16 Fabien Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 International License.