News for hackers. Stuff that matters.
Re:The Gang of Four is Wrong and You Don't Understand Delega... by daemin on Tuesday August 14, 2012 @09:13PM (#4383927)
Correct me if I am wrong, but it seems to me that (Lieberman) delegation is quite a dangerous concept when applied to the most popular object oriented languages. You're effectively calling another object's methods and masquerading yourself as that object, or to put it another way you're exposing all of your privates and implementation details to another object. Hence it is much more dangerous, and potentially quite incorrect, than just forwarding.

The only safe way I can see this being done is by adding a reference to object A when calling/forwarding a method on object B. But that's just forwarding with extra data.

Maybe I haven't worked enough with fully dynamic languages, but I don't really see much or any benefit to doing 'Lieberman' delegation, over and above other options.

Re:The Gang of Four is Wrong and You Don't Understand Delega... by raganwald on Tuesday August 14, 2012 @10:11PM (#4384101)
Liberman deleation is fine-grained multiple inheritence. If I say I'm delegating the implementation of method foo to object bar, it sounds unsafe. If I say I'm inheriting the implementation of method foo from object bar, it seems safer, albeit not "classical OO."
Re:The Gang of Four is Wrong and You Don't Understand Delega... by daemin on Thursday August 16, 2012 @12:07AM (#4389858)
Thanks, that makes far more sense to me.