Foreword by Peter Wegner,
Instructor's Guide
This is a book about object-oriented software development.
It reflects the contents of an upper-level undergraduate course
on Object-Oriented Programming, given at the Vrije Universiteit Amsterdam.
Features of this book
- It provides an introduction to object-oriented programming,
covering design, languages, and foundational issues
concerning abstract data types and inheritance.
It also pays attention to environments, library support and
application frameworks for OOP, in particular for graphical user interfaces
and hypermedia.
- It contains an exposition of the conceptual issues underlying
the design of object-oriented languages,
and in particular the notion of active objects (that is,
the extension of
object-oriented languages with concurrency) is covered in detail.
- Foundational issues
and formal aspects of object-oriented programming are
examined extensively.
A major theme of the book is to establish precisely the relation between
the guidelines and prescriptions emerging from software engineering practice
on the one hand, and
the constraints and insights originating out of a type theoretical
analysis of abstract data types and polymorphism on the other.
- Many of the notions introduced and problems discussed are clarified
by short programs,
most of which
are in C++. However, no prior knowledge
of C++ is required since a brief tutorial on C++,
as well as on Smalltalk and Eiffel, is included in the appendix.
- The material is organized around slides.
The slides occur in the text in reduced format, but are also available
for use on an overhead projector.
Each slide captures some important notion or concept
which is explained and commented upon in the accompanying text.
A separate {\em Instructor's Guide} is available,
which provides hints for presenting the slides and answers
to the questions posed at the end of each chapter.
Intended readers
This book may be used as the primary text for a course on OOP
or independently as study or reference material.
It may be used by the following categories of readers:
- students -- as a textbook or as supplementary reading
for research or project papers.
- software engineers -- as (another) text on object-oriented programming.
- professional teachers -- as ready-made material for a course
on object-oriented programming.
Naturally, this is not meant to exclude other readers.
For instance, researchers may find the book useful
for its treatment of the foundational aspects of OOP,
or programmers may benefit from the hints and example programs in C++.
Another reason for using this book may be its compact representation
of already familiar material and the references to other (often research) literature.
The book is meant to be self-contained.
As prior knowledge, however, a general background in computer science
(that is, computer languages and data structures as a minimum)
is required.
To fully understand the sections that deal with foundational issues
or formal aspects, the reader must also
have some knowledge of elementary mathematical logic.
Organization
The book is divided into
four parts.
Each part presents the issues involved in
object-oriented programming from a different
perspective, which may be characterized respectively
as design, languages,
foundations and applications.
Part I: Designing Object-Oriented Systems
1. Introduction:
This chapter gives an introduction to the area
of object-oriented programming.
It presents some background and summarizes the viewpoints
adhered to in the rest of the book.
It also gives a global view on the object-oriented
life cycle and discusses object-orientation as a
paradigm of programming.
It further presents an overview of the material covered
with reference to the literature used and
suggestions for further reading.
2. Object-oriented programming constructs:
This chapter explains the basic notions underlying
object-oriented programming, notably
encapsulation and inheritance.
Also, it introduces the programming language C++.
A canonical approach to
developing concrete data types
is presented
and some of the benefits and pitfalls
of object-oriented programming in C++
are discussed.
3. Object-oriented design:
This chapter discusses the process of software
development and the various modeling perspectives
involved in analysis and design.
It further explains the issues involved in arriving
at a proper object model,
introduces the notion of contract as an instrument
to capture the relationships between object classes,
and discusses
the transition from specification to design.
4. Software engineering perspectives:
In this chapter the notion of robust software is
taken as a starting point to explore the relevance
of test methods for the validation of object-oriented software.
In particular, we discuss the notion of
runtime consistency as enforced by behavioral contracts.
Also, we take a look at a number of metrics
for object-oriented software and discuss
some guidelines for class design.
Part II: Object-Oriented Languages and Systems
5. Object-oriented language design:
This chapter explains concepts underlying
the design of object-oriented languages
and gives a characterization of a number of
them,
in particular Smalltalk,
Eiffel and C++.
It further presents some alternative object models
and discusses dynamic inheritance by delegation.
It also analyses issues involved
in meta-level architectures for class-based languages.
6. Distribution and concurrency:
This chapter discusses the relevance of distribution
and concurrency for object-oriented modeling.
It analyses the relation between objects and
processes and presents the notion of
active objects as a means of introducing
concurrency in object-oriented languages.
It deals with a number of concurrent
extensions of C++ and discusses problems
involved in combining processes by inheritance.
Finally, the chapter explores some of the requirements
for distribution.
7. Composition mechanisms:
This chapter explores a number of composition
techniques that may be employed in the development
of object-oriented systems.
These composition mechanisms include inheritance and
interaction through delegation.
Further, it explores cooperation
schemes, such as the MVC paradigm,
which are employed in window-based applications,
and it gives an example of employing an
event-driven computation model to guarantee
global consistency.
Part III: Foundations of Object-Oriented Modeling
8. Abstract data types:
This chapter considers the notion of abstract data types
from the perspective of types as constraints.
It presents an algebraic approach in which objects
may be characterized as algebras.
Further, it explains the difference between
the classical approach of realizing abstract data types
in procedural languages and the realization of abstract
data types in object-oriented languages.
The implications
of a more pragmatic conception of types
is also discussed.
9. Polymorphism:
This chapter discusses inheritance from a
declarative perspective,
and gives a precise characterization of
the subtype relation.
It further discusses the various flavors
of polymorphism and presents a type theoretical
treatment of genericity and overloading.
Also, type calculi that capture
data hiding and self-reference are given.
These insights will be related to the realization of polymorphism
in Eiffel and C++.
10. Behavioral refinement:
This chapter extends the notion of types
as constraints to include behavioral properties.
It presents an assertion logic for the verification
of programs and discusses the operational
model underlying the verification of object behavior
based on traces.
It further gives precise guidelines to
determine whether classes that are syntactical subtypes
satisfy the behavioral refinement relation.
Finally, an overview is given of formal approaches
to characterize the behavior of collections of objects.
Part IV: Object-Oriented Application Frameworks
11. Libraries and environments:
This chapter discusses the problems involved
in application development and raises the issue
of standards.
It discusses some of the design choices that may
arise in developing libraries,
presents a number of methods and tools
that may be used in software development,
and
discusses the criteria for evaluating
class libraries, mentioning a number of libraries
for C++.
Included is a list of ftp sites where these libraries
may be obtained by those having access to the Internet.
12. Hypermedia frameworks:
This chapter asserts the relevance of object-oriented
technology for the development of hypermedia.
It discusses the notions underlying hypermedia
and presents a model allowing for the inclusion of timing
constraints.
Further, it discusses a multi-paradigm approach
to programming multi-media interfaces,
and explores some of the problems
involved in developing heterogeneous systems.
The chapter
concludes with some reflections
on the future of object-oriented programming.
Tracks
Preface,
Instructor's Guide
For those developing a course on object-oriented programming,
the book offers a choice between various tracks,
for which the ingredients are sketched below.
Also, an indication is given of the sections that contain
more advanced material.
The
programming track, consisting
of chapters 2, 5, 7 and 12, may be augmented with
material from the appendices and chapters 6, 8 and 11.
The software engineering track,
consisting of chapters 1, 3, 4 and 11,
may be augmented with material from the theoretical
track as indicated.
The theoretical track,
consisting of chapters 8, 9 and 10,
may need to be augmented with more general
information concerning OOP provided in the other tracks.
Background and motivations
My own interest in OOP stems from my research on the
language DLP, a language
integrating logic programming with object-oriented features
and parallelism (\Eliens, 1992).
When looking for material for a course on
object-oriented programming, I could not find a book
that paid sufficient attention to foundational
and formal aspects.
Most of the books were
written from a perspective on OOP that did not quite suit
my purposes.
What I was looking for could to some extent only be
found in research papers.
As a consequence, I organized my OOP course
around a small number of papers,
selecting
the papers that, to my mind,
can be considered as landmark papers,
papers that have become known as originally presenting
some significant notion or insight.
The apparent disadvantage of basing a course on OOP
on papers is the obvious lack of a unified view,
and of a consistent use of terminology.
The advantage of such an approach, however,
is that students are encouraged to assess
the contribution of each paper and to form their
own view by comparing critically the different viewpoints
expressed in the papers.
Personally, I favor the use of original papers,
since these somehow show more clearly
how the ideas put forward originated.
Later, more polished, renderings of these same ideas
often lack this quality of `discovery'.
The idea of organizing a book around
slides came quite naturally,
as the result of structuring the growing collection of
slides, and the wish to maintain the compact representation
offered by the slides.
The choice of material reflects my
personal preference for foundational issues,
in other words, papers that are focused on concepts
rather than (mal)practice.
The choice of material has also been colored by my interest
for (distributed) hypermedia systems and (to some extent) by
my previous work on distributed logic programming.
Although the book is certainly not focused on language constructs,
modeling issues as well as foundational issues are generally related
to existing or conceivable language constructs,
and (whenever possible) illustrated by working examples developed
for that purpose.
The choice for C++ to present the examples reflects my belief
that C++ is a valid programming language for object-oriented programming.
However, I also believe that in the (near) future multi-paradigm
approaches (extending C++) will play a significant role.
The approach taken in this book may be characterized
as abstract,
in the sense that attention is paid primarily to concepts
rather than particular details of a solution
or implementation language.
By chance, in response to a discussion in my class,
I looked up the meaning of abstract
in a dictionary, where to my surprise I learned
that one of its meanings
is to steal, to take away dishonestly.
Jokingly, I remarked that this meaning sheds a different
light on the notion of abstract data types,
but at a deeper level I recognized the extent
to which the ideas presented in this book have profited
from the ideas originally developed by others.
My rendering of these ideas in a more abstract form
is, however, not meant to appropriate them in a dishonest way,
but rather to give these ideas the credit they deserve by
fitting them in a context, a framework encompassing
both theoretical and pragmatical aspects of object-oriented computing.
As one of the meanings of the adjective abstract,
the dictionary also lists the word abstruse
(not easy to understand).
There is no need to say that, within the limits of
my capabilities, I have tried to avoid becoming abstruse.
Finally,
in presenting the material, I have tried to retain a sufficient degree
of objectivity.
Nevertheless, whenever personal judgments have slipped in,
they are rather meant to provoke a discussion than provide
a final answer.
Information
For any questions or comments you may contact the author
at eliens@cs.vu.nl by electronic mail, or
at Dr A. Eliëns, Vrije Universiteit,
Department of Mathematics and Computer Science,
De Boelelaan 1081, 1081 HV Amsterdam,
The Netherlands.
Acknowledgements
In
writing this book, I have profited from the enthusiasm
and criticism of numerous students and colleagues.
In particular I should like to thank, in arbitrary order,
Hans van Vliet, Henri Bal, Dick Grune,
Cees Visser, Ira Pohl,
John Caspers,
Jacco van Ossenbruggen and Matthijs van Doorn.
Also, I should like to thank Chris Dollin
for his detailed and constructive comments.
Finally, thanks to
Simon Plumtree and Andrew McGettrick for,
as they will surely understand, `playing it by ear'.
The short musical phrases appearing at the beginning of each chapter
are taken from The Notebook for Anna Magdalena Bach
(which are intended primarily for young players).
Despite their apparent simplicity, however, they are acknowledged
by experienced pianists as being hard to play properly,
yet they are among the standard exercises for learner pianists.
In a way this reflects the problem of teaching object-oriented programming.
The concepts underlying object-oriented programming
may at first seem deceptively simple (and not require the complexity of C++ or
a type theoretical analysis).
However, in developing object-oriented models
some intrinsically difficult questions
remain, for which we have no definite answer
and which may even require extensive expertise and technology
to come up with a partial solution.
Returning to the music, I often find myself improvising,
leaving the written music for what it is,
a starting point.
Anton Eliëns
Amsterdam
October 1994