Re: Aggregation vs composition
From: Daniel T. (postmaster_at_eathlink.net)
Date: 04/21/04
- Next message: Sergei Gnezdov: "Re: responsiblity about MVC"
- Previous message: Daniel T.: "Re: responsiblity about MVC"
- In reply to: Matthias Hofmann: "Aggregation vs composition"
- Next in thread: Robert C. Martin: "Re: Aggregation vs composition"
- Reply: Robert C. Martin: "Re: Aggregation vs composition"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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...
- Next message: Sergei Gnezdov: "Re: responsiblity about MVC"
- Previous message: Daniel T.: "Re: responsiblity about MVC"
- In reply to: Matthias Hofmann: "Aggregation vs composition"
- Next in thread: Robert C. Martin: "Re: Aggregation vs composition"
- Reply: Robert C. Martin: "Re: Aggregation vs composition"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|