From: paj@uk.co.gec-mrc (Paul Johnson)
Newsgroups: comp.object
Subject: Re: comparing object-oriented platforms
Date: 6 Oct 92 08:41:54 GMT
Reply-To: paj@uk.co.gec-mrc (Paul Johnson)
Organization: GEC-Marconi Research Centre, Great Baddow, UK

In article <1992Oct4.133146.964@ucc.su.OZ.AU>
>maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:

>[Agrees with GC] Conversely, C++'s constructor/destructor scheme is
>more powerful than Eiffel's more simplistic scheme.

I don't understand what you mean by this.  The Eiffel creation system
is as good as C++ (especially in Eiffel 3), and the C++ destructor
business is simply there because it lacks GC.  BTW in ISE Eiffel you
can arrange a routine to be called when an object is collected.  Its
part of the MEMORY class (but it only works for full collections,
unfortunately).

>A proposed design, A++,
>appears to me to be more advanced than the scheme presented
>in OOSC, although because C++ is so complex cf. Eiffel
>Eiffel might be able to optimise many of the assertions
>away at compile time where C++ would struggle with aliasing
>and other nasty problems.

Can you tell us about this A++.  I don't recall hearing about it
before.  I have looked at doing Eiffel-style assertions in C++, and it
is not trivial.

[On C++]

>The biggest advantage is that it provides a path for working
>programmers to learn new and better techniques, and keep being
>productive.  If they were already writing good ANSI C, the boss could
>secretly switch the compiler to C++ and they main thing they'd notice
>would be improved type checking and better diagnostics.

If all you want from C++ is "a better C" then this is true.  However
it is not true if you want to do OO programming.  As soon as you start
using inheritance, particularly multiple inheritance, you find that
C++ has major problems.  Take a look at the disambiguating rules in
the ARM some time.

>And even if they were superprogrammers and could learn
>Eiffel and OO in one day, it would be difficult
>to just rewrite a huge C project in Eiffel in 
>the next 6 days. With C++, you wouldn't have to.

Granted.  Legacies are always a problem when new technology comes
along.

>I'm interested in some anecdotal evidence on Eiffel Use.
>When I switched to C++, my pattern of programming changed
>radically. Most programs, if they dont work the very first
>time, work by the second or third time. By 'work',
>I mean execute cleanly. So I do not spend much time
>getting programs to run anymore. (Chasing bugs)

Take a look at my paper in TOOLS 7 (p335).  It describes the progress
of a project written in Eiffel.

>On the other hand, I spend much much more time on design.
>C++ classes are supersensitive to correct design, 
>if I stuff up a class I may have to rework a good fraction
>of the system. Once a class is heavily used (and reused),
>it is very hard to change it's interface.

This is very true.  The interface specification facilities in Eiffel
are there because of this issue.  Without them you tend to find a
"hidden" interface becoming important, as various bits of code take
advantage of behaviour which is not in the actual spec.  In Eiffel one
still has to guard against this, but it is much easier because the
assertions make it clear who is responsible for each bit of behaviour.

>So I estimate say 70% time on design, more than twice for
>C or Pascal. A typical program takes LONGER to write
>in C++, unless I just hack C. There are benefits
>for classes that get reused---but most dont.

This is not my experience in either C++ or Eiffel.

-- 
Paul Johnson (paj@gec-mrc.co.uk).	    | Tel: +44 245 73331 ext 3245
--------------------------------------------+----------------------------------
These ideas and others like them can be had | GEC-Marconi Research is not
for $0.02 each from any reputable idealist. | responsible for my opinions