Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!ukc!edcastle!lfcs!db From: db@lfcs.ed.ac.uk (Dave Berry) Newsgroups: comp.object Subject: Re: object-oriented this, that, and the other thing Message-ID: <1115@castle.ed.ac.uk> Date: 16 Nov 89 20:03:14 GMT References: <2426@umbc3.UMBC.EDU> <190@ark1.nswc.navy.mil> <1561@novavax.UUCP> <76915@linus.UUCP> <984@castle.ed.ac.uk> <1959@tukki.jyu.fi> Reply-To: db@lfcs.ed.ac.uk (Dave Berry) Organization: Laboratory for the Foundations of Computer Science, Edinburgh U Lines: 63 Some of the claims made in this group for OO languages compared to other languages seem a bit odd. For example, ADTs aren't only a feature of OO languages. If Simula 67 is OO then there exists an OO language that doesn't support ADTs. Another example was a recent article saying that a queue ADT only had to be implemented once. This is an example of polymorphism, which can be implemented in several ways, many of which aren't OO. One example that people pointed out was parameterised ADT's, These aren't a new concept either. I don't think that either OO or ADTS "came first" to programming languages. ADT's and the other features of a modern OO language seem to be linked strands of development of programming languages during the 70s. As one strand of this development, ADTs (including parameterised ADTs) have been used in several specification languages, such as CLEAR and ASL. All this makes me wonder which "other languages" people are comparing OO languages with. Perhaps if we were more specific in this respect we would reach a clearer idea of which features are OO and which features are related but useful. (I would guess that this confusion arises because OO languages are the first class of modern languages to make a big hit outside research labs, and that a lot of people are only seeing these features for the first time in OO languages. Which is another Good Thing about OO languages!) My opinion is that the main feature of an OO language is that objects contain information about their class. The effect of this is that we can build collections of objects of different classes, call a member function of an arbitrary object of that collection and get the correct function for that class. In other words, dynamic binding of functions (as opposed to dynamic binding of variables, as in old lisps). Some people have said that objects contain their member functions. This isn't true of any OO language I've seen. In these languages, classes contain member functions and each object (intuitively) contains a pointer to its class. If this seems nitpicking, consider the possibility of an OO language with functions as values. In such a language member functions would bear the same relation to function values as class attributes to object attributes. Inheritance and/or delegation are obviously important concepts too. In a statically typed language, inheritance as subtyping is needed to allow dynamic binding. In dynamically typed languages it doesn't seem strictly necessary to me, and seems to be used more as a way of reusing code (not that this isn't important). Ralph Johnson mentioned some time ago that Emerald is an OO language without inheritance. So my definition of an OO language would be "classes + dynamic binding of functions". with the footnote that inheritance is required for this in statically typed languages and damn useful anyway in dynamically typed ones. Of course, I'm probably wrong ... Dave Berry, Laboratory for Foundations db%lfcs.ed.ac.uk@nsfnet-relay.ac.uk of Computer Science, Edinburgh Uni. !mcvax!ukc!lfcs!db