Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!agate!shelby!neon!craig From: craig@Neon.Stanford.EDU (Craig D. Chambers) Newsgroups: comp.object Subject: Re: ADT vs. Objects Message-ID: <1990Nov13.212012.3662@Neon.Stanford.EDU> Date: 13 Nov 90 21:20:12 GMT References: <4255@oasys.dt.navy.mil> <658426218.13725@minster.york.ac.uk> <1990Nov13.094257.15308@tukki.jyu.fi> Organization: Stanford University Lines: 81 In article <1990Nov13.094257.15308@tukki.jyu.fi> sakkinen@jytko.jyu.fi (Markku Sakkinen) writes: >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. > >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. I agree most with the first "equation" for defining OOP. Inheritance seems to come in two flavors as well: subtyping (inheritance of specification/interface) and code sharing (inheritance of implementation). To me, late binding (and the accompanying subtyping in a statically-typed language) is the most important feature of object-oriented programming over abstract data type programming. Inheritance of implementation seems like something that could be moved out of the core language and into the programming environment, where more flexible and adaptive code sharing/automatic programming could be done without cramming a lot of functionality into a language mechanism. Inheritance rules seem overly complicated in most modern languages (e.g. CLOS, Eiffel, C++, and even Self), and are one aspect of an object-oriented that's likely to change or be outdated in 5 years. So why date a language with a complex feature that would be more malleable and adaptive in a programming environment? Of course, I'd have to implement such a wonderful system to convince most people; at this point, it's just an idea that may never pan out. So my official prediction for 1991 is that OO languages will continue to include code inheritance as a built-in language mechanism. In contrast to Peter Wegner's taxonomy, I'd relegate the presence or absence of classes to a minor role in classifying object-based languages. Here's my brief taxonomy: object-based: languages with objects (data structures with associated methods) object-oriented: object-based languages with message passing (selecting message implementation based at least in part on the implementation of argument objects; late binding) inheritance-based: object-based languages with code inheritance (either in the language or the environment) object-oriented-inheritance-based: object-oriented languages with code inheritance Other languages design choices and features, such as classes vs. self-sufficient objects, multiple dispatching, strong encapsulation, static typing and subtyping, parallelism, and physical distribution, can be mixed and matched to create an object-oriented language with particular characteristics for a particular purpose, but to me they're all object-oriented as long as they have objects and message passing. I only give a name to languages with inheritance because inheritance has a large impact on the structure of programs in the language, and so could reasonably be argued to deserve its own categorization. ADT-based languages are typically object-based with strong encapsulation added in to enforce the "abstract" part of the name. This taxonomy is motivated by identifying features that I consider to be powerful programming tools, rather than an attempt to distinguish existing programming languages and give them different labels, as was Peter Wegner's (much more extensive) taxonomy. -- Craig Chambers