Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!news.funet.fi!tukki.jyu.fi!sakkinen From: sakkinen@tukki.jyu.fi (Markku Sakkinen) Newsgroups: comp.object Subject: Re: ADT vs. Objects Message-ID: <1990Nov13.094257.15308@tukki.jyu.fi> Date: 13 Nov 90 09:42:57 GMT References: <4255@oasys.dt.navy.mil> <658426218.13725@minster.york.ac.uk> Reply-To: sakkinen@jytko.jyu.fi (Markku Sakkinen) Organization: University of Jyvaskyla, Finland Lines: 94 In article <658426218.13725@minster.york.ac.uk> paulb@minster.york.ac.uk writes: >In article <4255@oasys.dt.navy.mil> flitter@atisun.dt.navy.mil (Lance Flitter) writes: >> Greetings. I was wondering if someone would venture a good description >>of the difference between Abstract Data Types and Objects. Is there a >>difference? Is one a subset of the other? > >This is something that has been discussed quite a bit here at York >recently. We reached the conclusion that an object-oriented programming >language is basically a superset of abstract data types. A class is an >simply abstract data type, and an object is an instantiation of that ADT. > >Another way of looking at it is to notice that objects are *unique*, >i.e. two objects whose instance variables contain the same values are >*different* objects, whereas a value in an ADT-language is just a value, >and has no existence in it's own right. > >Whether uniqueness is an advantage or not is, of course, debatable. It >certainly causes some problems (just look at the implementation of sets >in SmallTalk to see what I mean). My own preference would be for a good >ADT language. There has been no tidewave of answers to the original question yet: it is important but difficult. Likely almost everyone has an idea that is a little different from others; I'm offering a variation of the above. Historically, Objects are older than ADT's. In Simula (67) the essential novelty of objects was the packaging of functionality together with data. Abstraction and encapsulation have entered the picture of OOP much later. An object is a natural extension of a variable in a conventional, imperative programming language; therefore it is also natural to distinguish objects by identity (uniqueness) and not by the values they contain, just like conventional variables. Other influences to current OOPL's have come notably from semantic data models and from frame-based AI systems; of course also from programming languages that incorporate ADT ideas (CLU, Ada, Modula-2, ...). Objects in Simula and in some (not most) newer OOPL's can have one property that clearly does not fit within the ADT framework: an internal activity, not only operations (methods) that can be invoked. In some respects, OOPL's can be more restricted than typical ADT's. The ADT approach puts no restrictions on how binary (and ternary or higher degree) operations or functions on a type may be defined. In contrast, Smalltalk and some other OOPL's don't allow an object to see inside another objects even of the same class. Among the most distinctive traits of OOP are _inheritance_ ('prefixing' in Simula) and _late binding_ (for which many use the overstatement 'message passing'), especially in combination. Some people suggest the following definition at least as an approximation: OOP = ADT + inheritance + late binding (Sorry, I don't remember the origin just now.) The three-stage classification of Prof. Peter Wegner from OOPSLA'87 seems to be quite popular, and he presented it again in the first issue of OOPS Messenger (published by ACM SIGMOD). - Object-based: the class of all languages that support objects. - Class-based: the subclass that requires all objects to belong to a class. - Object-oriented: the subclass that requires classes to support inheritance. Incidentally, I don't see this classification as very relevant; it is a rather arbitrary choice among the many aspects in which existing, more or less object-oriented languages differ from each other. One can also suspect some kind of grudge against the Ada community behind this scheme, because it just nicely leaves Ada in the lowest category. - However, don't miss Wegner's new article, "Concepts and Paradigms of Object-Oriented Programming": it gives a very broad perspective. There are some new OOPL's that abandon classes altogether and are instead based on the principle of existing objects acting as prototypes for new ones. One can hardly speak about ADT's in such languages. Contrary to what "paulb" said, many languages based on ADT's are identity-oriented and _not_ value-oriented. This is true even of the best-known pioneering ADT language, CLU. The basic datatypes are an exception, but so are they in Smalltalk. (I think this exception is ugly; we had a good fight over this issue in this group some months ago.) On the other hand, many ideas and features typical of OOPL's can be adapted also into a value-oriented language that does not support object identity. For instance, the OOPS+ database programming language, which has been developed in the Esprit KIWI project, seems to take an essentially value-oriented approach (there was a paper at ECOOP'88). Markku Sakkinen Department of Computer Science and Information Systems University of Jyvaskyla (a's with umlauts) Seminaarinkatu 15 SF-40100 Jyvaskyla (umlauts again) Finland SAKKINEN@FINJYU.bitnet (alternative network address)