Skip to main content
Top

1995 | Book

Eiffel Object-Oriented Programming

Author: A. J. Tyrrell

Publisher: Macmillan Education UK

Book Series : Computer Science Series

insite
SEARCH

About this book

Eiffel is a pure object-oriented programming language which is attracting growing attention both in education and in industry. It is a high-level language, and is particularly suitable as a starting point for those who wish to learn the fundamentals of object orientation. Eiffel is, however, much more than a teaching language: it incorporates an approach to software development based on ideas of reusability, extendibility and reliability. Uniquely among object-oriented languages, it was created with mechanisms for making formal assertions about software components, based on the 'design by contract' philosophy. This book provides an introduction to object orientation and a practical introduction to virtually all the features provided by the Eiffel programming language. It is suitable for those with some experience of programming who wish to learn about object-oriented programming. It will also appeal to those who already have some knowledge of object orientation, and wish to find out about the Eiffel language. After an introductory chapter on object orientation, several of the early chapters review basic concepts required by readers with little formal knowledge of computer programming. From chapter 6 onwards the author examines more difficult issues of object instantiation, copying and comparison, and the use of class libraries for string and array handling.

Table of Contents

Frontmatter
1. Introduction to Object Orientation
Abstract
There is little that is new in object-oriented software development. Its main ideas have been known for over two decades since the development of the programming languages Simula and Smalltalk. It is now a well-established technology, and its advantages are well understood. If only we could learn to use it well, we should be able to build high quality software systems which
  • are modularised and decentralised;
  • are factored around data rather than processes;
  • are built using existing well-tested components;
  • promote the development of new components;
  • are easy to understand and maintain;
  • are better able to withstand change;
  • allow a relatively seamless transition from analysis through to design and implementation.
A. J. Tyrrell
2. Writing a Simple Class in Eiffel
Abstract
The reader should already have gathered the following from chapter 1:
  • a class may be defined as a template from which objects may be created;
  • in Eiffel a class is also the basic program unit: we write classes, and only classes;
  • every Eiffel application must have a single root class; conceptually the application may be thought of as an object of this class
  • the root class must include a creation routine which is executed when a system is loaded;
  • other classes may or may not have creation routines.
A. J. Tyrrell
3. Eiffel Basic Types
Abstract
The previous chapter has already introduced the basic types supported by Eiffel. This chapter provides examples of operations that may be performed on attributes of the basic types. First, however, it provides an introduction to the concept of type.
A. J. Tyrrell
4. Eiffel Control Instructions
Abstract
Previous chapters have introduced three types of instruction:
  • the creation instruction used for dynamic allocation of memory to an object;
  • the assignment instruction used to attach the result of an expression to a variable;
  • the call, used to invoke a feature defined in a class.
A. J. Tyrrell
5. Eiffel Routines
Abstract
The routines introduced in the preceding chapters have been introduced mainly to illustrate features of the Eiffel language. The role of a routine in object-oriented programming ought now to be clarified:
  • in the context of object-oriented development the routine is a secondary concern, whereas in the context of process-oriented development it has a major role in decomposing a problem into manageable small tasks;
  • in object-oriented software development, data is given a more privileged position, whereas functions and sub-functions are the primary organising idea in traditional software development;
  • the primary focus in object-oriented software development is on the classes of objects in the system being modelled;
  • classes provide a combination of state and behaviour, and externally may be viewed as collections of data and services;
  • in the context of Eiffel, routines are features of a class which if public, are used to provide the services required by clients, or if private are used to perform auxiliary tasks necessary to satisfy the requests of clients;
  • in pure object-oriented languages such as Smalltalk and Eiffel, routines, or ‘methods’ as they are known in Smalltalk, are associated with a particular class, and can be invoked only when sending a message to an instance of that class.
A. J. Tyrrell
6. Classes, Objects and Instantiation
Abstract
Chapters 2 to 5 have introduced the lower level features of the Eiffel language. The reader should now have enough grasp of the language to return to the basic ideas of object-orientation introduced in chapter 1. This chapter explores the relationship between classes and objects, introduces the Eiffel facilities for data hiding, and discusses issues of memory allocation, object copying and object comparison.
A. J. Tyrrell
7. Classes STRING and ARRAY
Abstract
Strings and arrays are fundamental to programming. In Eiffel they are not a part of the languages, but are provided in class libraries. There are some differences between the libraries for STRING and ARRAY produced by different vendors, but fortunately there is a great deal of standardisation. The author has moved relatively freely between ISE Eiffel and Eiffel/S in preparing this chapter.
A. J. Tyrrell
8. Assertions and Software Correctness
Abstract
Software systems have been beset by errors since the dawn of the computing age. Type checking has enabled a number of potential errors to be eliminated at the compilation stage. There are, however, many other sources of error which a compiler cannot detect, and the more complex the system the harder it is to eliminate all potential errors.
A. J. Tyrrell
9. Inheritance
Abstract
This chapter introduces single inheritance; it also covers the concept of polymorphism, the rules for conformance in Eiffel, and the related topic of reverse assignment. It concludes with a discussion of when inheritance is and is not appropriate.
A. J. Tyrrell
10. Generic Classes
Abstract
The term genericity is clearly related to the word ‘general’, and when we talk of genericity in the context of software construction we are talking about the capacity to produce components which have a general use. Such components are essential if we are to promote the reuse of code through the development of class libraries.
A. J. Tyrrell
11. Adapting Inherited Classes
Abstract
Frequently, when a class is inherited, the descendant class needs to make alterations to the inherited class. The most common forms of alteration are
  • changing the name of an inherited feature to avoid a name clash or to provide a more meaningful name within the context of the new class;
  • redefining an inherited feature so that it has a different meaning or behaves differently to the inherited feature;
  • changing the visibility of an inherited feature, usually by making it private or restricting its use to a few named classes.
A. J. Tyrrell
12. Abstract Classes
Abstract
An abstract class may be defined as
  • a class which has one or more features whose implementation is deferred to a subclass;
  • a class which cannot be instantiated.
A. J. Tyrrell
13. Multiple and Repeated Inheritance
Abstract
Previous chapters have introduced single inheritance, and have looked at the ways in which the features of inherited classes may be altered by descendant classes. This chapter completes the study of inheritance by introducing multiple and repeated inheritance.
A. J. Tyrrell
14. Case Studies
Abstract
This chapter provides two case studies. The first builds on classes developed in the chapters on generic and abstract classes. The second, more complex study, implements a back propagating neural network from scratch. The chapter also illustrates the use of CRC cards in object-oriented design.
A. J. Tyrrell
Backmatter
Metadata
Title
Eiffel Object-Oriented Programming
Author
A. J. Tyrrell
Copyright Year
1995
Publisher
Macmillan Education UK
Electronic ISBN
978-1-349-13875-3
Print ISBN
978-0-333-64554-3
DOI
https://doi.org/10.1007/978-1-349-13875-3