Objects First

Preface

This book takes a new approach to the teaching of an "old" language. C has been with us for over 20 years now: this certainly makes it "old" in computer science terms! It starts with object-oriented principles of design rather than basic constructs of the language. The aim is to introduce good program design principles - the elements of software engineering - before even the simplest syntactical elements of the language. By doing so, it is hoped that students in their first programming course will not pick up poor program design strategies which have to be "unlearnt" in later courses.

In the first chapter, the idea of modelling objects in real or virtual domains is introduced. We look at constructing classes which define allowed behaviours of objects in our real or virtual world. The first lab exercise is not the "Hello world" program but one which uses an already coded class definition to perform some simple manipulations of an object. Thus the information hiding principle is one of the first things you will meet - and appreciate the benefits of - as you manipulate objects through an abstract (yet simple and natural) specification.

The object model is used extensively - even the traditional concepts of variable type are introduced in terms of classes.

Throughout these notes, when new terms are introduced for the first time, they will be set in bold face like this. These are key terms: you should make sure that you understand their meaning and significance!

Sometimes - as here - these terms will be familiar words ("class") used with a new and specific meaning in a programming context.

By adopting this approach, the transition from C to other object-oriented languages such as C++ or Java should be a trivial step. Converting a C class constructed with the techniques used here to a C++ or Java one will be, in most cases, simply a matter of changing some syntactical "sugar". Some examples of these transitions are included in appendices.

Key terms

class
a software model of an object which defines its behaviour

Continue on to Introduction to Classes
Back to the Table of Contents
© John Morris, 1997