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.
This was the beginning of the preface of the first edition. It still holds true. However, OO is a rapidly evolving field. As a consequence my book, publiahed in 1994, may have been considered to be outdated from the start. As all exaxmple, right after its publication, patterns came into the focus of public interest. As another example, think of the Java wave that has come over us. Clearly, a revised edition was needed in which those subjects, and other subjects, are covered, or, as in the case of CORBA, are covered in more detail.
Another reason is that the field of OO itself has matured considerably. The acceptaJlce of UML as a modeling standard is one example. The increased utiliza-tion of CORBA for business-critical applications is another sign that (distributed) object technology is being consitlered as sufficiently robust.
The availability of new topics in itself is not enough to justify a second edition, since new book have been published in which these topics are covered. You only have to think of the enormous number of book on Java ... A revised second edition of the book is justified however, in my opinion, since the book distinguishes itself from the competition by its approach. Set up as a series of lectures, organized around so-called slides, the book covers a large number of topics, some in depth, some more casually. From an educational point of view, the advantage of this approach is the direct availability of educational material, including the slides to be presented in classroom. For the average reader, moreover, the slides provide an overview which facilitates comprehension and recall.
Finally, another more personal reason for bringing out a revised edition is that both in research and teaching my experience with OO has become more extensive, and I may even dare say that my own thoughts about OO have matured to some extent. In particular, in my group we have developed a multi-paradigm OO framework, which was already introduced in chapter 12 of the first edition, that has been applied in, for example, business process reengineering and collective
improvisation on the Web. Although I do not plan to treat any of this material extensively, it does provide a basis for the examples and, moreover, the material (including articles, software and examples) will be available on the accompanying CDROM
Features of this book
· The book provides an introduction to object-oriented progamming, covering design, languages, and foundational issues. It pays attention to issues such as reuse, component technoloy, design patterns and in particular the application of object technology in Web applications.
· It contains guidelines for developing object-oriented applications. Apart from practicaJ examples it provides and overview of development methods as well as an introduction to UML, the standard for object-oriented modeling. In particular design patterns will act as a recurrent theme, or rather as a perspective from which examples and solutions will be discussed.
· Distributed object technology will be a major theme. The book provides an introduction to CORBA that allows the student to gain hands-on experience with developing CORBA applications. It also provides a discussion of competing technologies, and in particular it will elucidate the distinction between component technology and distributed objects. Examples in Java and C++ will be included.
· Another major theme of the book is to establish precisely the relation between the guidelines aJld prescriptions emerging from software engineering practice on the one hand, and the constraints and insights originating from theoretical research. In the book attention will be paid to foundational issues as well as the pragmatical solutions the designers of object-oriented languages have chosen to realize their ideas.
· Many of the notions introduced and problems discussed are clarified by short programs, mostly in Java, some in C++. The examples cover GUI development, business process reengineering and Web applications. No extensive knowledge of the progamming languages used is required since
a brief tutorial on a number of object-oriented programming languages, including C++, Smalltalk, Eiffel and Java, is given in the appendix.
· The material is organized around slides. The slides occur in the text in reduced format, but are also available in Powerpoint and Netscape Presentation format. Each slide captures some important notion or concept which is explained and commented upon in the accompanying text. An online Instructor's Guide is available that provides hints for presenting the slides and answers to the questions posed at the end of each chapter.
· The entire book, including the software from the examples and the Instructor's Guide is available electronically, on the accompanying CDROM as well as on the Internet. The electronic version contains links to other material on the Internet. The electronic version may be accessed also in slide mode that allows for presenting the material in a classroom equipped with a beamer.
Intended readers The book will primarily address all academic audience, or IT profeeaionals with all academic interest. Nevertheless, since I am getting more and more involved in joint research with business partners and the development of extra-academic curricula, examples are included that are of more relevance to IT in business. In particular, it contains a section on the deployment of (object-oriented) simulation for businss process redesign, and a section on the 3D visualisation of business data using object technology.
This book may be used as the primary text for a course on OO 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 software development .
· prvfessional teachers - as ready-made material for a course on object-oriented software development .
. Naturally, this is not meant to exclude other readers. For instance, researchers may find the book usefill for its treatment of foundational issues. Programmers may benefit from the hints and example programs in Java and C++. Another reason for using this book may be its compact repreeentation of already familiar material alld 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 perspeetive, which may be characterized respectively as software engineering and design, languages and system development, abstract data types and polymoryhism, aJld applications and frameworks.
Part I: Designing Object-Oriented Systems
1. Introduction: This chapter gives an introduction to the area of object-oriented software development. It gives a global view on the object-oriented life cycle and discusses object orientation as a paradigm of programming. It discusses a number of trends and technologies that have come into the focus of public attention and indicates their relevance to 'object-orientation' .
2. Idioms and patternts*: This chapter introduces idioms alld design patterns as means to capture recurrent structures and solutions in object-oriented programming. It distinguishes between idioms as solutions tied to a particular language and patterns which are the product of rational design. This chapter contains numerous examples, in Java.
3. Softwate engineering perspectives: This chapter diecusses the process of software development and the various modeling perspectives involved in analysis and design. It explains the issues involved in arriving at a proper object model and introduces the notion of contract as an instrument to capture the relationships between object classes. In addition, it proposes a method for validation and testing based on contracts.
4. Application development*: In this chapter we develop a complete application and discuss the issues involved in its design and realization. It presents guidelines for (individual) class design, and gives an example of how to derive all implementation from a formal specification.
Part-II: Object-Oriented Languages and Systems
5. Object-oriented languages: This chapter provides a comparison between objectoriented languages, including Smalltalk, Eiffel, C++ and Java. It further discusses a number of alternative languages, included Self and Javascript, each writh their own object model, and treats issues such as dynamic inheritance by delegation. synchronous active objects, and meta-level architectures for class-based languages.
6. Component technology*: This chapter discusses the relation between component technoloy and distributed object technology, and will give a brief overview of the solutions that are available on the market, including Microsoft COM/ActiveX, JavaBeans, Java RMI and CORBA. It also presents a simple workgroup application and an example of integrating CORBA with aJI existing software library.
7. software arthitecture*: In this chapter we explore how software architecture affecte design and implementation. It treats design patterns for distributed object systems, and looks at the technical issues involved in developing multi-lingual systems. As all example we show how to employ the native interface to embed an existing framework in Java. Patrt Ill : 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 implicationa of a more pragmatic conception of types is also discussed.
9. Polymoryhism: 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 .are related to the realization of polymorphism in Eiffel, C++ and Java.
10. Behavioral refinement This chapter extende the notion of types as constraints to include behavioral properties. It presents all assertion logic for theverification of programs and discusses the operational model underlying the verification of object bebavior based on traces. It further gives precise guidelines to determine whether classea that are syntactical subtypes satisfy tbe behavioral refinement relation. Finally, an overview is given of formal approaches to characterize the behavior of collections of objects.
Part IV; Object-Oriented Applieation Frameworks
11. Business process redesign*: In this chapter we look at the opportunities IT offers in (re)designing busioess processes. In particular, we look at (objectoriented) simulation as a means to capture the logistical aspects involved in business process modeling, and in addition we look at how simulation models can be made available as to allow decision making, by deploying visualisation and dissemination over the Web.
12. Web applications*: In this chapter we look at how object technology may be applied to the Web. We will look both at client-side extensions and server-side solutions. In particular, we look at systems that employ CORBA in addition to other Web technologies. We also briefly look at another new trend in computing, intelligent, mobile agente, and we argue that agents are a direct derivation from object technology.
Appendices The appendices contain brief tutorials on Smalltalk, Eiffel, C++, Java and the distributed logic programming language DLP. They also contain an overview of UML, an overview of CORBA IDL, a tutorial on programming CORBA applications .with Orbacus, and suggestions for small and medium-term projects.
Tracke For those developiqg a course on object-oriented programming, the book offers a choice between various tracks, for. which the ingredients are eketched below. Also, aJI indication is given of the sections that contain more advanced material.
The programming track, consisting of chapters 2, 4, 5 and 12, may be aug mentecl with material from the appendices and chapkers 6 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.
Differences vrith respect to the first edition For clarity I have marked the chapters that have been substantially cllanged with an asterisks.
Adding new topics is one thing, eliminating parts of the book, naturally, is quite another thing. Yet I have chosen to remove the chapters on C++ (previously chapter 2), software engineering issues (chapter 4), concurrency in C++ (chapter 6), composition mechanisms (chapter 7) , software libraries (chapter 11) and hypermedia (chapter 12). Some of this material, for example parts of the hypetmedia chapter (12) , composition mechanisms (7) , and software engineering issues (4), will reappear elsewhere. Nevertheless, since some of it is obsolete, and
other material does not function well in classroom, it is better to remove it, and allow its space to be taken by other topics.
Background and motivations My own interest in object-oriented languages and software development stems from my research on the language DLP, a language integrating logic programming with object.oriented features and paranelism (Eliens, 1992). When looking for material for a course on object-oriented programming, I could not find a book that paid suffcient attention to foundational and formal aspects. Most of the books were written from a perspective on OOP that
did not quite suit my purpoaes. 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 dearly 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 reaects 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 in (distribuked) hypermedia systems, the Web and, to some extent, by my previous work on distributed logic programming. Although the book is certainly not focused on language constructs, modeling issus 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 Java as the main vehicle for presenting the program fragments amd examples is motivated simply by the popularity of Java. The presentation of some of the other examples in C++ reflects my belief that C++ must still be considered as a valid programming language for object-oriented software development. However, I also believe that in the (near) future multi-paradigm approaches (extending Java and 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 suffcient degree of objectivity. Nevertheless, whenever personal judgments have slipped in, they are meant rather to provoke a discussion than provide a final answer.
Information The electronic version can be found at
http : //www. cs. vu. nl/-eliens/online/00
For any questions or comments you may contact the author at eIiens@cs . vu . nl by electronic mail, or at Dr A. Eliens, Vrije Universiteit, Faculty of Sciences, Division of Mathematics and Computer Science, De Boelelaan 1081, 1081 HV Amsterdam, The Netherlands.
Contents of the CDROM The CDROM contains a complete online version of the book, including additional lectures, software and links to resources on the Internet. This online version may be used for presentation in the classroom, using the Netscape Presentation Format, which is supported by Netscape Navigator 4.x or better and by Internet Explorer 4.x or better. For each chapter, the CDROM also provides a Powerpoint presentation, that may be adapted by the lecturer.
For additional information, see README file on the CDROM.
Acknowledgements In writing this book 1 ,I have profited from the enthusiasm and criticism of numerous students and colleagues. In the latter years it has been Jacco van Ossenbruggen, Bastiaan Schonhage and Martijn van Welie, my PhD students, who have been unrelenting in their advice, criticism and quest for conceptual clarity.
Some of the material in this book has been taken from jointly written papers. The material on the handle/body idiom in chapter 2 is due to Jacco van Ossenbruggen. The workgroup application in chapter 6 has been written by John Caspers. The section on architectural atyles in chapter 7 is due to Baetiaan Schonhage. And the material in chapters 11 and 12 has been developed in close cooperation with Jacco van Ossenbruggen, Bastiaan Schonhage, Martijn van Welie, Frank Niessink, Dirk Bolier, Sam Megens and Paul Nash. I also thank my colleague Hans de Bruin for providing me with the material on software architectures; Thiel Chang, principal manager of ASZ Rnsearch and Development, and the ASZ/SanFrancisco team, consisting of Arne Bultman, Joris Kuipers, Ard van der Scheer, Remco van de Woestijne and Irmen de Jong, for their enthusiastic collaboration in an interesting project; and last but not least my students, who
gave a fresh look on object orientation in their term papers.
For the first edition I owe thanks moreover to, in arbitrary order, Hans van Vliet, Henri Bal, Dick Grune, Cees Visser, Ira Pohl, John Caspers, and Matthijs van Doorn. Also, I thank Chris Dollin for his detailed aod constructive comments on the first edition. And finally, my editors, Sally Mortimore, who got me the contract for the second edition, Keith Manssfield, who took over where Sally left off, Alison Birtwell and Karen Sutberland, for their assistance, Hedwig van Lier (from Pearson Education), for providing me with nice book, Julie Knight, who
guided me through the production phase, Karen Mosman with whom I discussed the possibilities of an online version on a number of successive Web conferences, not forgetting Simon Plumtree and Andrew McGettriclc 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. Although other composers contributed to the 'notebook', these phrases occur in a selection of pieces, composed by Johann Sebastian Bach, which are intended primarily for young players. Despite their apparent simplicity, however, they are ackcnowledged by experienced pianiats 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 objectoriented programming. The concepts underlying object-oriented progamming may at first seem deceptively simple (and not require the complexity of C++ or a, type-theoretical analysis) . However, in developing object-oriented modde and applications some intrinsically difficult questions remain, for whick we have no
1The picture on the cover is from Louis Soutter, Souplesse, 1939, Peinture au doigt, 44 x 58 cm, Musee cantonal des Beaux-Arts, Lausanne. Photo J.-C. Ducret, Musee cantonal des Beaux-Arts, Lausanne. 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 Eliens
Januari 2OOO