------art_9938_18261053.1142347942360
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 3/14/06, James Edward Gray II <james / grayproductions.net> wrote:
>
> On Mar 14, 2006, at 6:11 AM, Peter Fitzgibbons wrote:
>
> > Hello all,
> >
> > Can someone explain to me the reason for SimpleDelegator over using
> > "just a
> > variable".
>
> I asked the same question when I wrote the documentation for that
> library.  We tried and tried, but only ever came up with one semi-
> reasonable use for it.
>
> It you wrap something with SimpleDelegator and hand it off to some
> method, you could later change the underlying delegation object, even
> though you wouldn't have access to the variable the object is stored
> in.  This still seems like a stretch to me since some event will need
> to trigger the change and you could probably just build the API to
> hand-off the new object at that point.  Still, it's the only use I've
> ever come up with.
>
> In short, I suspect it's a not often used feature.   ;)
>
> James Edward Gray II
>
>
>
Lets see if I get this with a metaphor : If I own the Atomic Clock, and I
give you one of those "auto-updating" watches, I can change the time on your
watch (the delegated object), even though I don't own the watch anymore or
even have a reference to it.

I guess that misses it because I think I just described the Observer
pattern.

Hm..

In reference, I'm looking for the reason that GoF Strategy Pattern (ie.
composition) with this
discussion<http://article.gmane.org/gmane.comp.lang.ruby.general/109237>requires
anything more than using a variable and wrapping the delegate calls
as necessary.  One suggesting was Forwardable or Delegator, but with this
mystery over Delegator, and my understanding of duck-typing and
reflection-based methods, I don't get why they would have an advantage.

Thanks for your insight James.

--
------------------------------
Forget the icing.  Bake the Cake!
   - the epi-centered developer
------------------------------
Peter Fitzgibbons

------art_9938_18261053.1142347942360--