From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2ea02452876a15e1 X-Google-Attributes: gid103376,public From: Jean-Pierre Rosen Subject: Re: Real OO (was Choice of OO primitives in Ada95) Date: 1996/02/22 Message-ID: <199602221711.SAA18350@email.enst.fr> X-Deja-AN: 140661501 sender: Ada programming language x-sender: rosen@email.enst.fr comments: Gated by NETNEWS@AUVM.AMERICAN.EDU content-type: text/plain; charset="us-ascii" mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Windows Eudora Light Version 1.5.2 Date: 1996-02-22T00:00:00+00:00 List-Id: At 03:17 22/02/1996 GMT, Don Harrison wrote: This time I can't resist responding.... Here we go: >The real issue to me is that the Ada 95 OO model falls short of what real >object- >orientation is about. The purpose of OO, as I see it is this: > >"To enable the cost-effective development of correct, reliable and maintainable > software". Agreed. >The sub-goals required to facilitate this are: >a) Allow decomposition of the software into intelligible modules each of which > represents a clearly defined abstraction and has a clearly defined interface > with other abstractions > >b) Allow the construction, where possible, of abstractions using abstractions > that are already defined, customising them as necessary rather than > defining abstractions from sctrach. > >c) Allow the valid state of an abstraction to be clearly defined and enforced. Are you sure these are the best sub-goals ? That there are no other ones ? And that in stating the goals, you were not influenced by the conclusion you wanted to draw ? But let's go with it for the moment. >In order to acheive those goals optimally, an OO language should offer: > >1) encapsulated abstractions (classes) OK, but of course you mean that there must be a clear separation, at language level, between specification and implementation >2) inheritance/polymorphism of those abstractions How can you deduce this from b) ? Inheritance is definitely one possible way, but you are claiming here it is the only one. I think building an abstraction by putting together standardized, appropriate building blocks and lower level abstractions is another way of achieving b) that does not require inheritance. Both approaches have benefits and drawbacks. I'm just irritated each time I see that because inheritance is one way of solving a problem, people think it is the only one. >3) control over the state of those abstractions (assertions). I think a typing system that does not allow adding a length to a velocity is much more important for c) than assertions that are nothing more that a user definable function call. > >Taking each in turn (and not attempting to justify them), > >1) Best provided by pure OO (eg. Eiffel, Smalltalk) followed by hybrid OO > language with proper classes (extendable types mapped onto modules) > eg. (C++, myriad others) followed by hybrid OO with non-encapsulated classes > (eg. Ada, CLOS?). Of course, I do not agree. For example, the presence of ONCE functions in Eiffel is a kludge to overcome the absence of package initialization that is nicely provided by Ada. And as for separating specs and implementations, Ada is the only language that does it nicely, without giving up safety. > >2) The linchpin of OO - any language claiming to be OO offers this. Including Ada 95, although I still think it has been overadvocated. > >3) The only significant OO language I know of that offers this is Eiffel. > Assertions are executable conditions which must be satisfied to guarantee > that an abstraction has a valid state whenever it is updated. These include: > [...] It was considered in the early stages of Ada (83) design, and rejected. Note also that assertions in Eiffel are much LESS reliable than one could think, since assertions are disabled while evaluation the condition for an assertion. This is necessary to prevent semantic dependencies to end up in infinite recursion, but limits the trust you can have in assertions. > >Note that Ada only fully satisfies 2) and has a sub-optimal mechanism for 1). I have a package for 3) if you want. It's less than 50 lines long, including comments. So what ? Your statements were biased towards the conclusion that Eiffel was the only appropriate language. I can come up with equally biased statements that will "naturally" conclude that Ada is the best OOP language. What about, for example: OOP is about modelling real-world objects. Since real-world objects evolve concurrently, no language should be called OO unless it provides concurrency. OK, this kills C++, Smalltalk, Eiffel, CLOS.... +------------------------------------o-------------------------------------+ | P-mail: | E-mail: rosen@enst.fr | | ADALOG - 27 avenue de Verdun | Tel: +33 1 46 45 51 12 | | 92170 Vanves - FRANCE | Fax: +33 1 46 45 52 49 | +------------------------------------o-------------------------------------+