I've just finished reading the excellent Effective Java by Josha Bloch, and I quote:
In item 14, Favor Composition over Inheritance, about halfway down page 75:
Sometimes the combination of composition and forwarding is erroneously referred to as
delegation. Technically, it's not delegation
unless the wrapper object passes itself to the wrapped object. [Which then has some
reference to Eric Gamma].
Not that I'm being picky or anything :)
Duncan
----- Original Message -----
From: "Thomas Singer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 15, 2001 3:58 PM
Subject: Re: [Eap-features] Forwarding -> actually delegation...
> Yes, Andrea, you'r right.
>
> Tom
>
> At 07:47 15.11.01 -0800, you wrote:
>
> >+1, but this pattern is usually called "delegation", not forwarding,
> >isn't it?
> >
> > Andrea Vicentini
> >
> >
> >----- Original Message -----
> >From: "Thomas Singer" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Thursday, November 15, 2001 15:34
> >Subject: Re: [Eap-features] Forwarding
> >
> >
> > > +1
> > >
> > > Indeed, the forward-ability is very powerful, because you are
> >allowed to
> > > hide more implementation details.
> > >
> > > Tom
> > >
> > > At 14:04 15.11.01 +0000, you wrote:
> > > >Hi,
> > > >
> > > >Would it be possible to add composition, where inheritance might
> >be
> > > >inappropriate.
> > > >
> > > >For example if I want my class to behave like most of a collection
> >class,
> > > >I could embed a ArrayList inside my class. I could then
> > > >select generate wrapper or forwarding, and from the methods I
> >choose have
> > > >code generated to forward the methods onto the private
> > > >instance variable.
> > > >
> > > >class MyCollection {
> > > > private ArrayList col = new ArrayList();
> > > >
> > > > // generate ...
> > > > public void add(Object a) {
> > > > col.add(a);
> > > > }
> > > >
> > > > ....
> > > >}
> > > >
> > > >This would be extermely useful for decorator like patterns where
> >behaviour
> > > >is being added selectively to some methods.
> > > >
> > > >There could also be an option to just generate all.
> > > >
> > > >Thanks,
> > > >
> > > >Duncan Godwin
> > > >
> > > >
> > > >
> > > >
> > > >_______________________________________________
> > > >Eap-features mailing list
> > > >[EMAIL PROTECTED]
> > > >http://www.intellij.com/mailman/listinfo/eap-features
> > >
> > >
> > > _______________________________________________
> > > Eap-features mailing list
> > > [EMAIL PROTECTED]
> > > http://www.intellij.com/mailman/listinfo/eap-features
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Find the one for you at Yahoo! Personals
> >http://personals.yahoo.com
> >
> >_______________________________________________
> >Eap-features mailing list
> >[EMAIL PROTECTED]
> >http://www.intellij.com/mailman/listinfo/eap-features
>
>
> _______________________________________________
> Eap-features mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-features
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features