comp.lang.ada
 help / color / mirror / Atom feed
* Re: Real OO (was Choice of OO primitives in Ada95)
@ 1996-02-22  0:00 Jean-Pierre Rosen
  1996-02-22  0:00 ` Matt Kennel
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Jean-Pierre Rosen @ 1996-02-22  0:00 UTC (permalink / raw)


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-------------------------------------+




^ permalink raw reply	[flat|nested] 19+ messages in thread
[parent not found: <Do7uyC.4K2@world.std.com>]
[parent not found: <Do7unJ.1sq@world.std.com>]
* Re: Choice of OO primitives in Ada95
@ 1996-02-20  0:00 Jon S Anthony
  1996-02-22  0:00 ` Real OO (was Choice of OO primitives in Ada95) Don Harrison
  0 siblings, 1 reply; 19+ messages in thread
From: Jon S Anthony @ 1996-02-20  0:00 UTC (permalink / raw)


In article <Dn22M0.G0D@assip.csasyd.oz> donh@syd.csa.com.au (Don Harrison) writes:
> Robert A Duff writes:
> 
> :In article <Dn0FqH.8Cw@assip.csasyd.oz>,
> :Don Harrison <donh@syd.csa.com.au> wrote:
> :>package X is
> :>  type MARRIAGE is tagged ...
> :>  type PERSON is tagged ...
> :>  type UNIVERSITY is tagged ...
> :>  type GOVERNMENT is tagged ...
> :>  type ELECTORATE is tagged ...
> :>  type ADDRESS is tagged ...
> :>
> :>...
> :>end X;
> :>

> :>Each abstraction is related to the previous one but isn't necessarily
> :>related to any other. As I understand it, the language rules dictate
> :>that each of these abstractions must be in the same package.
> :
> :No, they don't have to be in the same package (and as you say, probably
> :should not be).  Could you explain what you mean -- why do you think
> :that all of the above types have to be in the same package?
>
>  I don't have an RM available but quoting you (25.1.96) on the
> subject of dispatching operations in response to Arcadio A. Sincero:
> 
> > >As a matter of fact, the only indication that TPerson's Walk "belongs to
> > >it" is that TPerson's Walk has a TPerson parameter.
> 
> > That, plus the fact that it's in the same package.
> 
> So, if you want all of the operations to be dispatching (primitive), then the
> tagged types must also be in the same package.

What in this in anyway could even _possibly_ be construed in the
course of even the most tortuous path of illogic to be saying _all_
the types _together_ need to be in the _same_ package?  Hmmmmmm????


>  In the same thread, Jon S Anthony went on to say that
> non-dispatching operations using tagged types were those defined in
> different packages to those types:
> 
> > Just to add one more bit (completely beating it to death...), it is also
> > legal to have a subprogram with operands of both types as long as it is
> > not in the package where the two types are declared.  Of course such a
> > subprogram is not primitive and will never dispatch (assuming it has no
> > other controlling operands).

See above (possibly even more so).


>  Dispatching or not dispatching depending on where an operation is
> defined is not what you would call consistent.

Why not?  Seems pretty simple really.  And it allows for non
dispatching operations to be constructed if they have a closer match
to the desired semantics.  And why should operations that are closely
tied to the semantics of a type (basically the intent of primitive
operations) be definable anywhere?  That sort of thing leads pretty
quickly to inscrutable structures.  (I believe that Dylan does allow
this sort of thing, but there has been disagreement on how "wonderful"
it is.)


> A couple of other gripes:

>  1) Why should you have to specify that a type is 'tagged'? Can't
> the compiler work that out for itself? eg. by seeing whether the
> type is extended elsewhere. The developer is forced to worry about
> what should be an implementation issue.

Ahhh, the ol' clairvoyant compiler.  You are on a roll.  What if the
type is not extended?  This sort of comment might make sense if you
were discussing a language where the only kinds of types available
were "classes" (actually, it would not even make sense there as then
it would be irrelevant).  But you aren't.  Of course you can decry
this fact, but that is another matter altogether and irrelevant given
the current context.  Also, given the context, it is very much the
case that "tagged" is _not_ simply an implementation issue.  Flagging
a particular type as one which is extensible and supportive of dynamic
polymorphism can be argued to be a "good engineering" tradeoff.


> 2) Similarly, why should the developer have to specify that an
> operation dispatches (classwide operations)? Presumably, you're
> aiming for quicker execution, but compilers could perform a certain
> degree of optimisation eg. If it knows the type is not extended
> anywhere, there is no need to dispatch. There would also be
> situations where the specific variant of an inherited type is known
> eg. following an explicit assignment from an entity of that type.

This is just plain wrong - on several accounts.  First class wide
operations do not dispatch (they have uses more akin to a "generic
method" in CLOS, though clearly more restricted).  Second, _all_
primitive operations are dispatching operations.  The "developer" does
_not_ specify that an operation dispatches (other than simply
including it as a primitive operation of a tagged type).  Third,
optimization is irrelevant _to the semantics_ of whether any actual
_invocation_ dispatches.  Sans optimizations a primitive operation
dispatches iff it has class-wide actuals for the operation's
controlling parameters - the compiler _always_ knows when a particular
call of an operation dispatches.  Fourth, optimization is also
(mostly) irrelevant for making the design choice of keeping instances
of dynamic polymorphism a local rather than global issue.

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178

617.484.3383
jsa@organon.com





^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~1996-03-15  0:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-02-22  0:00 Real OO (was Choice of OO primitives in Ada95) Jean-Pierre Rosen
1996-02-22  0:00 ` Matt Kennel
1996-02-23  0:00   ` Robert A Duff
1996-02-22  0:00 ` Valery Croizier
1996-02-24  0:00   ` Robert A Duff
1996-02-22  0:00 ` Spencer Allain
1996-02-23  0:00 ` Jon S Anthony
     [not found] <Do7uyC.4K2@world.std.com>
1996-03-15  0:00 ` Don Harrison
     [not found] <Do7unJ.1sq@world.std.com>
1996-03-15  0:00 ` Don Harrison
  -- strict thread matches above, loose matches on Subject: below --
1996-02-20  0:00 Choice of OO primitives in Ada95 Jon S Anthony
1996-02-22  0:00 ` Real OO (was Choice of OO primitives in Ada95) Don Harrison
1996-02-22  0:00   ` Robert Dewar
1996-02-23  0:00     ` Gene Ouye
1996-02-26  0:00       ` James O'Connor
1996-02-26  0:00         ` Gene Ouye
1996-02-22  0:00   ` Jon S Anthony
1996-02-24  0:00   ` Robert A Duff
1996-02-26  0:00     ` Matthew B. Kennel
1996-02-26  0:00     ` Don Harrison
1996-02-24  0:00   ` Valery Croizier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox