Delegation And Consultation

Much of the time when we speak of Delegation in OOP, we might arguably be referring to a subtlely different concept called Consultation. I discovered this distinction when I ran across this article: http://javalab.cs.uni-bonn.de/research/darwin/delegation.html.

Basically, Delegation can be thought of as delegating execution to another object while retaining the identity of the calling object. Thus, if the object delegated to calls another method of its "self", that self is the original object, not the object delegated to. If, on the other hand, we hand off processing to another object, and the object acts on its own, with its own "self", and no implicit reference to the original message receiver, that is Consultation.

Of course, we've been using Delegation to refer to Consultation for so long that it is now arguably more "correct" to continue doing so, but I do think it's important to consider the difference between the 2, regardless of what words we actually employ. For instance, when we use wrappers to "Delegate", this is not the same thing as what Java Inheritance does when it delegates to a parent class, because the wrapped component does not treat the wrapping object as its "self".


Forwarding is another term for Consultation.


CategoryPolymorphism


EditText of this page (last edited January 12, 2006) or FindPage with title or text search