Re: Aggregation vs composition

From: Daniel T. (postmaster_at_eathlink.net)
Date: 04/21/04


Date: Wed, 21 Apr 2004 03:43:01 GMT


"Matthias Hofmann" <hofmann@anvil-soft.com> wrote:

> I am presently making myself familiar with the UML and I am a little stuck
> with the concepts of aggregation and composition.

In his book "Object-Oriented Design Heuristics" Arthur Riel has some
useful and enlightening comments...

"...there are three, and not two, relationships involving uses and
containment. The first is clearly a uses relationship and is never
confused with containment. A good example is "person uses an alarm
clock." There is no hint of containment here. Then there is the car and
its engine example. This is clearly containment (which implies uses).
However, a third relationship lies between these two extremes. Some
groups simply consider this intermediate category as a uses relationship
since it does not exhibit the design-simplifying attribute of a true
containment relationship. This relationship does not guarantee that we
can ignore the contained objects at some high level of design. The
important thing is to understand the three concepts; what we call them
is irrelevant."

So, in UML the three concepts are "uses", "aggrigates", and "contains".
I am among the "some groups" he mentions who simply consider the
intermediate category as a uses relationship. There is a marked
difference between the way a composite relationship is coded compared to
the other two. It is generally impossible to tell the difference between
a uses relationship and an aggregation just by looking at the code.

I will give my take on how the symbols came about, you are free to
disagree. Before UML there was OMT with its uses, aggregation, &
inheritance relationships; and Booch with its "uses", "has by
reference", "has by value", and "inherits from" relationships. I think
that Booch and Rumbaugh saw that their concept of uses & inheritance was
the same, I'm sure they also noticed that Booch's "has by value" mapped
pretty well to Rumbaugh's "aggregation", but what about Booch's "has by
reference"? Obviously, Booch felt the distinction was an important one
to make, and I'm sure they were concerned that if the fans of Booch
clouds (otherwise known as "Grady Grams") did not have a way to make the
distinction, then they would not be interested in adopting UML. So UML
ends up with "uses", "inherits" and "contains" which map to the three
concepts they both felt were important, and adds "aggrigates" as a
concept that they felt was necessary to be inclusive.

I hasten to say that I have not read anything from either author
directly or indirectly stating anything like what I have said above, it
is simply a feeling from my gut...



Relevant Pages

  • Re: Nuclear Reactor Design Caused GE Scientist To Quit In Protest
    ... While I can't read Japanese and so can't read the actual SAR file to the equivalent of the NRC to find out the design basis earthquake specifically for these units, the failureseem entirely to be the result of the tsunami after the tremblor. ... in general the containment design is a site-specific design and would not be in the actual design area of the reactor vendor other than for analysis of a given design for any particular plant. ... Nobody reports what is burning. ...
    (alt.home.repair)
  • Re: WISDOM of Crowds (Iden?ify -Uare the missing data)
    ... "You don't do good software design by committee." ... Aggregation. ... designing something would be for the group's opinion to be aggregated ... Collective Wisdom Shapes Business, Economies, Societies and Nations ...
    (sci.logic)
  • Re: OT-A Slow Day in The Cabinet Shop
    ... Even the small units that power subs and aircraft ... The US has only had one experimental fission reactor launched and that was ages ago while the Russians have used quite a few altho I don't know just how recently. ... There's sufficient shielding in a commercial design that one can be in containment but outside the biological shield area during operation even though that is a rare event not done in normal operation as there is no need for access there. ...
    (rec.woodworking)
  • Re: Self-containment in OO
    ... but is there a metric or method to measure functionality distribution? ... your aim should be a containment ... Do you recommend Riel's book to improve OO design? ... (summary of OO design from Riel) ...
    (comp.object)
  • Re: DCOM without AppID value under CLSID (e.g. wrapper?)
    ... I'll have a good look at all these articles and the book. ... Containment means that, inside B, we have an internal reference to an A object, and define all the functions available from A in B. In these newly defined functions, we simply redirect the calls to the corresponding function in A object. ... Aggregation means that, we return A when users query interfaces, so all the calls will be directly sent to A. ... Please feel free to let my manager know what you think of the level of service provided. ...
    (microsoft.public.win32.programmer.ole)