Object Oriented Software Construction
Object Oriented Software Construction
not for late binding. Finally, most existing object-oriented languages are more
directed towards rapid prototyping and lack reliability-enhancing concepts like
strong typing.
The programming language Eiffel was specifically designed for programming and
design in the style the author advocates. It comprises notions common to most
object-oriented languages, such as objects, classes, and (multiple) inheritance. The
special things in Eiffel are the strong typing mechanism and the use of assertions.
Strong typing (present in very few object-oriented languages) enables the compiler
to determine statically whether the result of an expression admits a certain operation,
but the actual code executed can still vary at run-time, depending on the specific
object that the expression delivers (this phenomenon is called late binding).
Assertions, in the form of boolean expressions, enable, the programmer to state
some properties of the system at a certain point in its execution. They can be used
as pre- and postconditions of routines, as class or loop invariants, or simply in
check instructions at arbitrary points in the code. Optionally they can be checked
at run-time (in order to achieve this, the expressive power of assertions had to be
restricted: quantification, for example, is not allowed). An interesting experimental
mechanism for exception handling has been based on this use of assertions. However,
in my opinion, this mechanism is not yet sufficiently mature. I also regret that the
assertions are not embedded in a formal system for program verification (although
I know very well how difficult it is to develop such a system).
Another concept that is not yet understood well enough is inheritance. In Eiffel
there are precise rules about the relationship between a parent class (‘superclass’)
and a descendant (‘subclass’). For example, the class invariant of the parent class
must be maintained by the descendant, and if a routine is redefined its precondition
in the parent class must imply the precondition in the descendant and the postcondi-
tion in the descendant must imply the postcondition in the parent class. All this
serves to ensure that whenever an instance of the parent class is expected, an instance
of the descendant can be used without problems. Therefore it is strange that Eiffel
does not enforce the well-known contravariant parameter type rule: if the parent
class a routine has a parameter of type 7, then in each descendant where the routine
is redefined, its parameter type should contain (be a super-type of) the type T. In
Eiffel, on the other hand it is required that the parameter type of the redefined
routine is a subtype of the original one. While this seems plausible, it can lead to
type errors.
Furthermore, in Eiffel as in all other strongly typed object-oriented languages I
know of, inheriting code from a class is necessarily connected with being a zyxwvutsrqponmlk
subt y pe
of that class. This means that whenever an element of the parent class is expected,
the type system also allows an instance of a descendant class to be used. Recently
it has been recognized that several problems with (multiple) inheritance can be
solved elegantly by decoupling these two hierarchies, the inheritance hierarchy
dealing with the internal implementations of the objects on the one hand, and the
type hierarchy dealing with their external interface on the other hand.
90 Book reviews
Despite these points of criticism, I still think that Eiffel is an excellent tool (if
not the best currently available one) for the purpose for which it was designed:
systematic development of reliable, reusable software.
Also, I really like the style of programming advocated in this book. It shows,
rather convincingly, that object-oriented programming and design, practiced in a
disciplined way, offer a definitely better alternative to traditional programming and
design techniques. Especially the reusability of software components can be drasti-
cally improved. It also shows that object-oriented programming is not just suitable
for rapid prototyping, but that it can be used advantageously for the development
of reliable (and efficient!) software products, provided the right tools and techniques
are used.
The book presents the concepts in an orderly manner and explains them very
well. It is certainly not just a book on Eiffel programming, and not even just a book
on object-oriented programming. It is even more attractive because it presents a
technique of object-oriented zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIH
design and explains why this technique is in many
cases superior to the traditional ones. At the technical level, the book contains an
extensive index and an adequate bibliography. There are only few printing errors
(of which surprisingly many occur in the figures). The paperback edition is reason-
ably priced. All in all, I can recommend this book to everyone who is interested in
object-oriented design and programming, and its first part even to anyone who is
not (yet) interested.
Pierre AMERICA
Philip Research Laboratories
Eindhoven, Netherlands
Algorithm Animation. By Marc H. Brown. MIT Press, London, 1988, Price L26.95
(hardback), ISBN o-262-02278-8.