From: richieb@bony1.bony.com (Richard Bielak)
Subject: On using Eiffel (Re: comparing object-oriented platforms)
Organization: multi-cellular
Date: Thu, 8 Oct 92 19:59:41 GMT

In article <1992Oct4.133146.964@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
>In article <92Oct1.173658edt.47938@neat.cs.toronto.edu> tlai@cs.toronto.edu (Tony Wen Hsun Lai) writes:

[...]
>
>The single biggest problem in C++ is probably dangling pointers
>and their converse, memory leaks. Eiffel's big strength in this
>area is GC. Conversely, C++'s constructor/destructor scheme
>is more powerful than Eiffel's more simplistic scheme.
>

I don't see how the constructor/desctructor scheme is more
powerful? Please explain.


>Secondly, I like Eiffel's assertion facility. However although
>C++ doesn't have one (the closest it comes is the assert macro
>and expection specifications), one could be added if the
>designers wanted to enough. A proposed design, A++,
>appears to me to be more advanced than the scheme presented
>in OOSC, although because C++ is so complex cf. 

[...]

Don't forget about class invariants. Also assertions and invariants
are inherited. This is not easily done with C macros.

Take a look at "Eiffel: The Language" for an updated description
of assertions.

[...]
>---------------------------------------------------------
>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)
>

Perhaps the hardest thing to do when programming in Eiffel was the
shift to object-oriented thinking. Once you start seeing objects
everywhere coding becomes easy.

Debugging Eiffel is a lot easier with assertions. About 99% of all
failures are assertion failures. These are easier to fix, as I can
see what assumption I violated.

On the other hand, tracing execution through polymorphic code can get
tricky.

Not having to deal with pointers and memory management is wonderful.
Although, reference semantics are a little confusing at the start.

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

Another nice thing about Eiffel is that it can be used as a design
language too. So the line between design and coding blurs further.

I seem to spent more time on the dynamic design of a program: i.e.
what objects will exist at runtime and how they interact.  During
design, inheritance comes in much later, when I try to classify the
objects in a system. In most cases determining who should inherit what
is obvious.

I use multiple inheritance during coding in a looser fashion, than
during design. Often there is no "is-a" relationship between the child
and parent classes. In these cases inheritance seems just too
convienient to be avoided.

Eiffel's renaming mechanism for avoiding name clashes in
multiple-inheritance is easy to use and understand.

>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.
>
>DO others experience this change in practice in Eiffel?

My Eiffel programs go together much faster that my Modula-2 programs.
This is mostly due to re-use of library classes and automatic memory
management. In Eiffel, I never have to implement a LINKED_LIST class,
but I do those all the time in Modula-2.

I find that's its hard to design a re-usable class. The class has to
be used for a while, before you can gain some experience and decide
what is essential and what can be left out.

Modifying interface to existing class in Eiffel is not that bad, since
you can easily find out who uses the class (using a browser).
Furthermore, the Eiffel compiler (ISE's compiler anyway) automatically
figures out what needs to be recompiled if some class changes. So
there is no "make" files to worry about.


What else would you like to know?


...richie


-- 
* Richie Bielak   (212)-815-3072   |                                          *
* Internet:       richieb@bony.com | Rule #1: Don't sweat the small stuff.    *
* Bang {uupsi,uunet}!bony1!richieb | Rule #2: It's all small stuff.           *
*    - Strictly my opinions -      |                                          *
Newsgroups: comp.object