next up previous
Next: Original version Up: Style examples Previous: Style examples

Hardware Store

The practice of abstraction is central to the creation of software. The single most important abstraction mechanism in C++ is the class. A class captures the common properties of the objects instantiated from it; a class characterizes the common behaviour of all objects that are its instances. Identifying appropriate abstractions is a critical part of programming in C++. To find good abstractions, the programmer must understand the underlying properties of the objects manipulated by the program.

To study the class as an abstraction mechanism, we examine a sample program and evaluate its strength and weaknesses, particulary with respect to the choice of classes. ALternative ways of writing the program with different classes and different class relationships appear. General rules of programming style, which will improve other programs, then emerge from rethinking the design and rewriting the code of the sample program.



Subsections

Porkoláb Zoltán 2001-09-03