grover%brahmand@Sun.COM (Vinod Grover) (10/07/89)
I once read that the inheritence mechanism is a special case of a more general phenomena called Delegation. I cannot come up with the reference but unless I am mistaken I think it was an article written by Stefik and Bobrow in the AI Magazine a few years ago. Since I have been out-of-touch with OO stuff for a couple of years, can anyone tell me if there has been any recent work done on the semantics of inheritence and/or delegation? Any pointers would be greatly appreciated. Thanks Vinod Grover grover@sun.com (415)-336-5570
render@m.cs.uiuc.edu (10/09/89)
Written 11:26 am Oct 7, 1989 by grover%brahmand@Sun.COM: >I once read that the inheritence mechanism is a special case of a more >general phenomena called Delegation. I cannot come up with the reference >but unless I am mistaken I think it was an article written by Stefik and >Bobrow in the AI Magazine a few years ago. I believe that you are thinking of the following article: "Object-Oriented Programming: Themes and Variations", by Mark Stefik and Daniel G. Bobrow. The AI Magazine, 6:4 (Winter 1986), pp 40-62. A good general paper on OOP, with discussion of the different terms and techniques involved. >Since I have been out-of-touch with OO stuff for a couple of years, can >anyone tell me if there has been any recent work done on the semantics of >inheritence and/or delegation? I'm sure there has. I know of one paper that compares the two: "Delegation is Inheritance", by Lynn Andrea Stein. Proceedings of the 1987 OOPSLA Conference, pp. 138-146. Check the Journal of OOP or later OOPSLA proceedings for more. hal.
dcr0@GTE.COM (David Robbins) (10/10/89)
>>Since I have been out-of-touch with OO stuff for a couple of years, can >>anyone tell me if there has been any recent work done on the semantics of >>inheritence and/or delegation? One good reference is from OOPSLA89: A Denotational Semantics of Inheritance and its Correctness (by William Cook and Jens Palsberg) This one addresses inheritance, but not delegation, although I suspect that some of it would apply to delegation as well. -- Dave Robbins GTE Laboratories Incorporated drobbins@gte.com 40 Sylvan Rd. ...!harvard!bunny!drobbins Waltham, MA 02254
grover%brahmand@Sun.COM (Vinod Grover) (10/11/89)
I recieved a number of replies concerning my query about Inheritence and Delegation. They are given below for anyone else interested. ================ From: rkr@june.cs.washington.edu (R. K. Raj) Henry Lieberman, "Using Protypical Objects to Implement Shared Behavior in Object Oriented Systems", Proceedings of the ACM Conference on Object-Oriented Programming Systems, Languages and Applications, pages 214-223, Sep 1986 Lynn Andrea Stein, "Delegation Is Inheritance", Proceedings of the Second ACM Conference on Object-Oriented Programming Systems, Languages and Applications, pages 138-146, Oct 1987 Markku Sakkinen, "Disciplined Inheritance", Proceedings of the Third European Conference on Object-Oriented Programming, pages 39-56, Jul 1989 From: swami@cssuN.tamu.edu (Swaminathan Natarajan) One paper that describes delegation, though probably not the original paper, is: "Dimensions of Object-based Language Design" by Peter Wagner, in OOPSLA 87 proceedings. From: dumbcat!marc (Marco S Hyman) See the article ``Genericity vs Inheritance vs Delegation vs Conformance vs ...'' by Blair, Gallagher, and Malik in the Sept/Oct 1989 issue of the Journal of Object-Oriented Programming. (Computer Literacy has it if you're in the Bay Area.) It says ``Inheritance can be viewed as a specialization of delegation in which the entities that inherit are classes.'' From: landauer@morocco (Doug Landauer) One decent paper that describes one way of looking at inheritance vs delegation is in OOPSLA '87 -- by Lynn Andrea Stein, "Delegation Is Inheritance". (Also == SIGPLAN Notices 22(12), December 1987.) This has some examples showing the differences, and then a proof that a delegation hierarchy (actually, a DAG) can always be modeled by some inheritance hierarchy, and vice versa. SELF is an example of a (Smalltalk-like) language which uses delegation instead of inheritance -- See "Self: the Power of Simplicity", also in OOPSLA '87, by Ungar & Smith. ================ Vinod Grover grover@sun.com
jeff@aiai.ed.ac.uk (Jeff Dalton) (10/11/89)
In article <125984@sun.Eng.Sun.COM> grover%brahmand@Sun.COM (Vinod Grover) writes: >I once read that the inheritence mechanism is a special case of a more >general phenomena called Delegation. I cannot come up with the reference >but unless I am mistaken I think it was an article written by Stefik and >Bobrow in the AI Magazine a few years ago. \bibitem{lieberman:delegation} Henry Lieberman. ``Using Prototypical Objects to Implement Shared behavior in Object-Oriented Systems.'' {\em OOPSLA '86 Conference Proceedings}, {\em SIGPLAN Notices\/} 21(11), November 1986. \bibitem{stefik:themes} M. Stefik and D. Bobrow. ``Object-Oriented Programming: Themes and Variations.'' {\em AI Magazine}, December 1985. \bibitem{stein:delegation} Lynn Andrea Stein. ``Delegation is Inheritance.'' {\em OOPSLA '87 Conference Proceedings}, {\em SIGPLAN Notices\/} 22(12), December 1987. The caricature version: Lieberman claims delegation is more general than inheritnace. Stein says it isn't: they're the same. -- Jeff
sdm@brunix (Scott Meyers) (10/12/89)
In article <125984@sun.Eng.Sun.COM> grover%brahmand@Sun.COM (Vinod Grover) writes: >I once read that the inheritence mechanism is a special case of a more >general phenomena called Delegation. I cannot come up with the reference >but unless I am mistaken I think it was an article written by Stefik and >Bobrow in the AI Magazine a few years ago. Lynn Stein, a graduate student here at Brown, proved that delegation and inheritance are equivalent. Hence, inheritance is not a "special case" of delegation. For the proof, see her paper in the OOPSLA '87 Proceedings: "Delegation Is Inheritance." Scott Meyers Brown University sdm@cs.brown.edu
johnson@p.cs.uiuc.edu (10/13/89)
>Lynn Stein, a graduate student here at Brown, proved that delegation and >inheritance are equivalent. Hence, inheritance is not a "special case" of >delegation. For the proof, see her paper in the OOPSLA '87 Proceedings: >"Delegation Is Inheritance." The proof consisted of reducing all objects to metaclasses. This is not very convincing unless you have Smalltalk style metaclasses in your language. Thus, the proof does not apply to C++, Eiffel, etc. I think that it is better to reduce delegation to regular message passing. It is easy to write a stub that implements a message by forwarding it to a component. If you also pass along the receiver as an argument to the message then the delegatee can send messages to the original receiver. This is the essence of delegation. In my experience, the overhead of having to do it yourself is so small as to be negligible. Ralph Johnson
johnson@p.cs.uiuc.edu (10/13/89)
>Delagation is better than Inheritance, because >1) Inheritance violates encapsulation by the superclasses, therefore >2) Inheritance makes concurrency more difficult in the resultant system. I've heard this before. It has never made sense to me, though a later part of the message might clear it up. However, somebody at OOPSLA this year said exactly the opposite--that inheritance was better for concurrency than delegation because delegation introduced performance bottlenecks. I don't really have much of an opinion on the subject yet. >Delagation reflects reality better than inheritance: your car does not >inherit from door, tire, and engine: is is a composite made up of >doors, tires, and an engine. The fact that the window on the left door >is open should have no bearing on the state of other windows or the >fuel injection or tire pressure. Ack! BLechttt! This is evidence of the dread disease of Flavors! This bears NO relationship to real inheritance at all. Inheritance is supposed to be the IS-A relationship, but a Car is not a Door. A door is a component of a car, it is not a superclass of Car. >The average depth of inheritance in most systems is about 3. The >number of object types in many systems is very large, in the dozens to >thousands. Therefore, people tend to favor delagation over inheritance >by a large margin, even when they don't consider it to be an issue. The average depth of inheritance in my systems is more like 5 or 6, but that doesn't change your argument much. However, this argument seems to hinge on the point that components and delegation are the same thing. That is not true. "self" in a delegated message has to be the original reciever. The usual terminology for sending a message to a component in which "self" should be the component is "forwarding". I think that I am in general agreement with the author who sparked this reply. In particular, I believe that component relationship should NOT be modeled by inheritance. Instead, instance variables are a better approach. However, it is important to get terminology right, and not to confuse delegation with forwarding. Ralph Johnson
sciore@bu-cs.BU.EDU (Edward Sciore) (10/13/89)
Another relevant paper is "Object Specialization" which just appeared in the April 1989 issue of ACM Transactions on Office Information Systems. In that paper I propose a strategy which seems to be an effective combination of the two approaches. By "effective", I also mean "practical" -- the ideas of the paper have been implemented in the VISION Object-Oriented Database System, which has been commercially available for several years now.
jeff@aiai.ed.ac.uk (Jeff Dalton) (10/21/89)
In article <135300006@p.cs.uiuc.edu> johnson@p.cs.uiuc.edu writes: >>Delagation reflects reality better than inheritance: your car does not >>inherit from door, tire, and engine: is is a composite made up of >>doors, tires, and an engine. The fact that the window on the left door >>is open should have no bearing on the state of other windows or the >>fuel injection or tire pressure. > >Ack! BLechttt! This is evidence of the dread disease of Flavors! >This bears NO relationship to real inheritance at all. Inheritance >is supposed to be the IS-A relationship, but a Car is not a Door. >A door is a component of a car, it is not a superclass of Car. Real inheritance? NO relationship? This is just ideology talking. Inheritance doesn't have ot be IS-A at all. If that's the attitude people are going to take, I'll choose delegation over "real inheritance" any day. BTW, Flavors doesn't say: inherit from parts; it says inherit capabilities. (IMHO). I don't like cars inheriting from doors either.