Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!daugher From: daugher@cs.tamu.edu (Dr. Walter C. Daugherity) Newsgroups: comp.object Subject: Re: The essence of objects... Summary: OOP has inheritance and polymorphism, ADT's don't have Keywords: OOP, ADT, inheritance, polymorphism Message-ID: <7239@helios.TAMU.EDU> Date: 8 Aug 90 03:08:06 GMT References: <1288@media01.UUCP> <5666@hplabsz.HPL.HP.COM> <5743@hplabsz.HPL.HP.COM> Sender: usenet@helios.TAMU.EDU Organization: Texas A&M University Lines: 46 In article <5743@hplabsz.HPL.HP.COM> cook@hplabsz.HPL.HP.COM (William Cook) writes: >.... My point was that object-oriented >programming arises from a technical dichotomy in the organization of >the observers and constructors of a data abstraction. Abstract data >types and objects (which I call procedural data abstractions) >are the result of these two alternatives. Organization by `observer' >results in an abstract data type; organization by `constructor' results >in a object/class structure. I think I would say that ADT's lack inheritance and polymorphism. One important consequence of the latter is that any extension to an ADT requires revising the code for all of its operators. This is not true in OOP. For example, consider an "graphic object" ADT (i.e., something you want to manipulate on a display) with operations such as "draw yourself" and "report your area." If this ADT encompassed rectangles and ellipses then each operation would have a SWITCH/CASE statement, e.g., float function area(g_o) graphic_object *g_o; { switch (type_of(g_o)){ case RECTANGLE: area = height_of(g_o) * width_of(g_o); break; case ELLIPSE: ... } The draw_self procedure is similar. Now to add another type, say TRIANGLE, requires both functions to be modified (by adding another case and its code). In contrast, in OOP you do not code the SWITCH statement: it is implicit in the system that a message to an object invokes the method for the object's class **INDEPENDENTLY** of any other classes which may have methods of the same name. So the AREA and DRAW_SELF methods of the RECTANGLE and ELLIPSE classes remain intact, and you only code the methods for the new TRIANGLE class. This eliminates the prospect of ruining previous code because it isn't touched. Hope this helps. ------------------------------------------------------------------------------- Walter C. Daugherity Internet, NeXTmail: daugher@cs.tamu.edu Knowledge Systems Research Center uucp: uunet!cs.tamu.edu!daugher Texas A & M University BITNET: DAUGHER@TAMVENUS College Station, TX 77843-3112 CSNET: daugher%cs.tamu.edu@RELAY.CS.NET ---Not an official document of Texas A&M---