Programmers who use the software development method described in Chapters 1 and 2 seldom tackle each new program as a unique event. Information contained in the problem statement and amassed during the analysis and design phases helps the programmer plan and complete the program. Programmers also use segments of earlier program solutions as building blocks to construct new programs. At the very least, they use knowledge gained from previous programs.
The approach followed in the design phase of the method is called stepwise refinement. This means that we start with the most abstract formulation of a problem and work down to more detailed subproblems. In this chapter, we will show several ways to facilitate and enhance the top-down approach to programming.
In
Section 3.3 we motivate the various control
structures that appear in Chapters 4 through 7. In Section 3.4 we introduce an important concept in data structures, the
enumeration type, and in Section 3.5 we present an important concept in system structures, the
package. You will see how packages are used by working with a standard
Ada package, Calendar
, which provides date and time services in a
way common to all Ada compilers.
You will also see how to use two package provided with this book. The first package, Screen, provides several services for dealing with the terminal screen--namely, clearing the screen, moving the cursor to a specific row-column position, and making the terminal beep. The second package is called Spider and gives you commands to move a "spider" around its "room" on the screen.
Copyright © 1996 by Addison-Wesley Publishing Company, Inc.