Re: aggregation and states / multiplicity on compositions



Date view Thread view Subject view Author view Attachment view

From: Gonzalo Génova (ggenova@inf.uc3m.es)
Date: Thu 06 Jun 2002 - 15:46:39 BST


>Ulf wrote:
>As for the creation of parts, UML does not seem to say anything about
>this [please correct me if I'm wrong].

I quote UML v1.4, p. 3-81:

"Composite aggregation is a strong form of aggregation, which requires that
a part instance be included in at most one composite at a time and that the
composite object has sole responsibility for the disposition of its parts.
The multiplicity of the aggregate end may not exceed one (it is unshared)."

This seems to me rather ambiguous. The "sole responsibility for the
disposition of its parts" apparently means that only the whole can create
and destroy its parts. But if you can change composition links dynamically,
then you may not violate the words of this law, but you indeed do violate
its spirit.

Let's state that "the car has the sole responsibility for the disposition of
its wheels". As far as a wheel belongs to a car, nobody can "touch" it. But
you can create a wheel outside of a car and attach it to the car later, or
you can detach a wheel from a car and destroy it later. You are within the
law, but what is there left of this "sole responsibility"?

UML allows explicity a minimum multiplicity 0 in a composition, that is, a
part can exist without being attached to any whole. In fact, the UML
metamodel has plenty of compositions with multiplicity 0..1 on the "whole"
end. In my opinion, this is the root that the "sole responsibility" has no
practical effects, it means nothing in practice. Instead, composition should
require minimum multiplicity 1, that is, composition should mean
inseparability (min=1) as well as unshareability (max=1), as it was
suggested in B. Henderson-Sellers and F. Barbier, "Black and White
Diamonds", Proc 2nd IEEE conference on UML: UML'99, LNCS, No. 1723, pp.
550-565, 1999.

Gonzalo

==========================================================================

Gonzalo Genova                        ggenova@inf.uc3m.es
Research and Teaching Assistant       http://www.ie.inf.uc3m.es/ggenova/
Department of Computer Science        http://inf.lab.inf.uc3m.es/
Carlos III University of Madrid       http://www.uc3m.es/

Escuela Politécnica Superior
Avda. de la Universidad, 30
28911 Leganés – Madrid – Spain
Tel. (34) 91 624 91 07
Fax (34) 91 624 91 29

Date view Thread view Subject view Author view Attachment view