Talk:Delegation pattern

From Wikipedia, the free encyclopedia

The Delegation and Proxy pattern look very much alike. Some more information in the differences and similarities between those two patterns would be welcome here. Avernet 18:54 19 Jun 2003 (UTC)

I've heard a lot of people talking about the ‘delegation’ pattern lately. I wondered why? It's not a classic GOF pattern. There might be a few legitimate reasons to use it, but I've yet to hear a compelling reason. Unlike the ‘proxy’ pattern which serves a legitimate purpose, the ‘delegation’ pattern seems like a code bloating anti-pattern to me. Why is it so popular? I just bought Wiley's Patterns in Java Volume 1. Sure enough, it's the first pattern listed. Ah!

[edit] Observations

The criticisms section is making non-submissible arguments.

The criticism is based on the observation that an incorrect implementation may not work correctly. This is a tautology and holds for any code in any language. If the design pattern was complicated to the extent that writing a correct implementation is considered difficult, then that would be a valid criticism.

Also I suggest an 'applicability' section describing an example of where this pattern may be preferable to an alternative such as standard OO inheritance, and perhaps a case where this pattern is less-preferable than an alternative pattern etc..

[edit] Applicabilty

I added an applicabilty section in PHP. Feel free to switch this to something more mainstream such as java or C++. This should clarify the use of this pattern and also clear up any confusion between this and the proxy pattern.

I browsed through the various patterns on wikipedia and found the majority of the text borderline useless and confusing. Additionally there are very few discussions on how a particular pattern might be applied to solve a real world problem.

Please comment on the usefulness/clearness of my applicability example. Should it be decent I'll go ahead and start working on the other patterns as well. --Begby 18:10, 2 March 2006 (UTC)