Talk:Delegation pattern

message: Is Kotlin the most appropriate language for the example? What criteria were used to choose it? I think languages based in C syntax are more common, so programmers are more likely to understand the example. Be it C++, C#, or even ES6.  — Preceding unsigned comment added by 195.57.119.44 (talk) 13:16, 14 March 2018 (UTC)
thread_title:  Language election 

message: I think the proliferation of examples is problematic.  I think the following issues need to be considered,addressed.
* Are two Java examples necessary.
* Are C++ and Objective C examples necessary.
* All example languages are similar, where are the examples in functional or declarative languages, or even a notational example e.g. UML.
* Perhaps all programming languages should use a consistent example.
MartinSpamer (talk) 11:47, 17 December 2007 (UTC)
replies: text: Agreed! A couple of examples, one simple and one complex case, in ONE programming language would be enough! Too many examples actually pollute this page! 200.32.121.66 (talk) 15:25, 5 July 2012 (UTC)
replies: text: Removed all the examples except the Java one. The rest where mostly syntactic variants. Qwertyus (talk) 16:13, 11 September 2012 (UTC)
thread_title:  Examples 

message: The Delegation and Proxy pattern, as well as the Strategy pattern, all 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)
They are similar.  I would classify Proxy to be a specialisation of the more general delegation pattern.  In the Proxy both the Subject and the Proxy conform to the same interface, this isn't the case with delegation. MartinSpamer  —Preceding unsigned comment added by MartinSpamer (talk • contribs) 12:31, August 29, 2007 (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!
You are right to say that it's not a classic GOF pattern. The GOF book considers delegation to be a technique that forms a building block for several patterns (e.g. State, Strategy, Visitor), rather than a pattern in itself. There's a section on Delegation in the introduction of the GOF book.  —Preceding unsigned comment added by 194.133.18.67 (talk) 08:18, 3 April 2008 (UTC)
thread_title:  Delegation vs. Proxy pattern 

message: 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)
thread_title:  Applicabilty 

message: The node Delegation (programming) talks at length about the Delegation pattern, yet Delegation pattern already has its own node. Shouldn't they be merged? --Devnevyn 12:47, 11 August 2007 (UTC)
thread_title:  Suggest merge with [[Delegation (programming)]] 

message: Hmm. I added an example for Objective-C. Since they call it 'delegates', I assumed it was the delegation pattern. However, after actually RTFA I realize that it doesn't seem to be at all the same. Does anyone know what my code is actually a pattern of, so that I can move it to a more appropriate place? Or does it actually fit here? --Devnevyn 13:19, 11 August 2007 (UTC)
thread_title:  ObjC example 

message: Isn't this just a more general case of Opaque_pointer. If so, maybe some information linking the two should be present. 202.10.86.59 11:42, 31 October 2007 (UTC)
thread_title:  This and pimpl 

message: I cannot extract from the article when it's best to use this pattern. Can someone give a motivation or an example in which situation it's good to use this pattern. I know that it in Java e.g. it's used by swing. But I don't know with which aim. 
Maybe it would be good, to add an motivation section to the article. 80.144.128.176 (talk) 10:25, 11 March 2008 (UTC)
thread_title:  Motivation and use 

message: Aren't these two basically the same?
138.246.7.155 (talk) 13:14, 6 November 2008 (UTC)
thread_title:  Overlaps with [[Strategy pattern]] 

message: The first paragraph states "It passes the buck, so to speak (technically, an Inversion of Responsibility)." but there is nothing intrinsic to delegation that means any responsibility is inverted. Delegation is one way in which inversion of control can be implemented but they are not the same thing nor necessarily linked. Can we take this bit out? Kylotan (talk) 18:29, 15 April 2011 (UTC)
thread_title:  Inversion of Responsibility? 

message: I agree with this. Inversion of control really refers to object composition (how is the object created at run time), while this article is meant to describe the behavior of an object within the context of its responsibilities Helios2k6 (talk) 20:54, 21 February 2013 (UTC)
thread_title:  Seconded 

message: Galzigler (talk) 21:55, 19 June 2017 (UTC)
thread_title:  Which DP category does it belongs to? 

message: This article is backwards.  It first talks about how specific languages handle the pattern and then offers a definition of the pattern afterward. 
=== Suggested Structure ===
* Keep first sentence as is.
* Move all the text of the Definition section to follow the first sentence, removing the Definition section heading in the process.
* With the Definition section now gone, create two new sections, "Example" and "Language Support"
* The Example section contains the Kotlin example and the sentence that precedes it.
* The Language Support section contains the sentence following the Kotlin example and at least the first four sentences of the paragraph that follows it.
* The final sentence in that paragraph does not seem to belong in the paragraph at all, since it is not about language support.  Suggest moving it to follow the definition and immediately precede the "Example" section.
— Preceding unsigned comment added by Roobyroo (talk • contribs) 16:01, 28 June 2017 (UTC)
thread_title:  Content needs restructuring 

message: * Keep first sentence as is.
* Move all the text of the Definition section to follow the first sentence, removing the Definition section heading in the process.
* With the Definition section now gone, create two new sections, "Example" and "Language Support"
* The Example section contains the Kotlin example and the sentence that precedes it.
* The Language Support section contains the sentence following the Kotlin example and at least the first four sentences of the paragraph that follows it.
* The final sentence in that paragraph does not seem to belong in the paragraph at all, since it is not about language support.  Suggest moving it to follow the definition and immediately precede the "Example" section.
— Preceding unsigned comment added by Roobyroo (talk • contribs) 16:01, 28 June 2017 (UTC)
thread_title:  Suggested Structure 

message: The example given for the delegation pattern is not actually delegation, but forwarding. The sender isn't being passed as an argument to the delegate, as the article seems to suggest would be characteristic of the delegation pattern, and the called method has no access to the original sender. I would suggest replacing the existing example with an example in Lua, partially because it's easy to read, and partially because the delegation pattern is common in Lua. rdococ... (talk) 06:57, 25 April 2019 (UTC)
replies: text: I was going to raise a topic on this, but you nailed it. The example is indeed Forwarding (object-oriented programming), and a good one at that. D98dbu (talk) 12:22, 23 December 2023 (UTC)
thread_title:  Example is not delegation, but forwarding