Re: Aggregation vs composition

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


Date: Fri, 30 Apr 2004 03:21:57 GMT

Richard Corfield <rcnews2@littondale.dyndns.org> wrote:

> On 2004-04-28, Robert C Martin <unclebob@objectmentor.com> wrote:
> >
> > Even that is an overstatement. C has no responsibility at all. We
> > hope that the designer has the sense to make sure not to use B after
> > B's destruction.
>
> I may be weighing in the wrong way, as slrn my newsreader only lets me
> see parent articles but I've not found a way of finding those parents'
> children. Like many computer users, I stick with the familliar and think
> of anything else as unfamilliar.
>
> Anyway, surely aggregation and composition are conceptual things. They
> do tell you what your implementation wants to achieve, a said before,
> it lets you work out who's responsible for lifecycle events.

But what are these "lifecycle events"? What does it mean to have "sole
disposition for" an object? Be sure to only use language neutral
concepts...

> Footballers
> may be part of a team through aggregation. When the team goes bust, they
> don't go and kill off the players, at least in a civilised society. Toe
> could be thought of as composite part of foot. Lose the foot, and the
> toes go with it.

Yes, I may end up with a convert here! :-)

> A previous post mentioned hiding the details of the contained object.
> That, to me, is another principle. Wasn't it called Demeter or
> something?

Yes, the "Law of Demeter".



Relevant Pages

  • Re: Aggregation vs composition
    ... C has no responsibility at all. ... could be thought of as composite part of foot. ... Then clients of Foot needn't depend on Toe. ... and having all clients knowing about the contained class. ...
    (comp.object)
  • Re: Aggregation vs composition
    ... > handing out references to Toe, and what happens if something tries ... > along with its Foot? ... abdicated its responsibility. ... > row count on the UPDATE, or find some way of detecting the bad reference ...
    (comp.object)
  • Re: Top 10 Reasons to be a TE.
    ... >>>don't know that this legitimately translates to a responsibility ... > picked it up and accidently dropped it on your foot, ... Things outside of our comprehension are outside of our comprehension, ... So you're left with faith ...
    (talk.origins)
  • Re: The latest Oxy slander (or is it liable?)
    ... responsibility ends when others have to foot the bill for the ... That logic can be used to control every aspect of people's lives. ... we outlaw anything that might lead to the govt having to foot the bill. ...
    (alt.support.chronic-pain)