< previous page page_906 next page >

Page 906
When we examined struct data types in Chapter 14, we explained that the components combine to describe an object or an entity of some kind. We also introduced the concept of data abstractionthe separation of the logical properties of data and actions from the implementation details.
In Chapter 15, we expanded on these concepts by defining the notion of an abstract data type (ADT) and by using the C++ class mechanism to incorporate both data and operations into a single data type. We described how each object of a given class maintains its own private data and is manipulated by calling its public member functions.
In this chapter, we examine how classes and objects can be used to guide the entire software development process. Although the design phase precedes the implementation phase in the development of software, we reverse the order of presentation in this chapter. We begin with object-oriented programming, a topic that includes design but is more about implementation issues. We describe the basic principles, terminology, and programming language features associated with the object-oriented approach. After presenting these fundamental concepts, we look more closely at the design phaseobject-oriented design.
Object-Oriented Programming
Throughout this text we have used top-down design (also called structured design) to develop algorithmic problem solutions. Top-down design decomposes a problem into modules, where each module is a self-contained collection of steps that solves one part of the overall problem. The process of implementing a top-down design is often called structured (or procedural) programming. Some modules are translated directly into a few programming language instructions, whereas others are coded as functions with or without parameters. The end result is a program that is a collection of interacting functions (see Figure 16-1). Throughout structured design and structured programming, data are considered passive quantities to be acted upon by control structures and functions.
Structured design is satisfactory for programming in the small (a concept we discussed in Chapter 4) but often does not scale up well for programming in the large. In building large software systems, structured design has two important limitations. First, the technique yields an inflexible structure. If the top-level algorithm requires modification, the changes may force many lower level algorithms to be modified as well. Second, the technique does not lend itself easily to code reuse. By code reuse we mean the ability to use pieces of codeeither as they are or adapted slightlyin other sections of the program or in other programs. It is rare to be able to take a complicated C++ function and reuse it easily in a different context.

 
< previous page page_906 next page >