From the UML Superstructure 2.4.1:
An association declares that there can be links between instances of the associated types. A link is a tuple with one value for each end of the association, where each value is an instance of the type of the end. (UML Superstructure, Page 37)
Nothing more, nothing less. and very vague. Because of this, it is also very hard to understand. What I defined (In a course I teach) is a hierarchy of links from dependency to composition where:
- Dependency from
A
to B
means that A
uses B
but indirectly (say by receiving instances of it and forwarding them to other objects).
- Association from
A
to B
means that A
uses B
directly, (for example by calling methods)
- Aggregation from
A
to B
means that B
is part of A
(semantically) but B
can be shared and if A
is deleted, B
is not deleted. Note that this says nothing about how the "is part" is implemented.
- Composition from
A
to B
is like Aggregation, where B
cannot be shared and if A
is deleted, all of its aggregates (B
s) are deleted also.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…