Previous | Next | Table of Contents | Index | Program List | Copyright

CHAPTER 3

Problem Solving and Using Packages


3.1 Problem Solving: Building Programs from Existing Information
3.2 Problem Solving: Extending a Problem Solution
3.3 Problem Solving: Structured Programming
3.4 Data Structures: Introducing Enumeration Types
3.5 System Structures: The Importance of Packages
3.6 System Structures: Using Ada's Calendar Package
3.7 System Structures: Using a Screen-Control Package
3.8 Continuing Saga: Introducing the Spider
3.9 Tricks of the Trade: Common Programming Errors
Chapter Review

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.


Previous | Next | Table of Contents | Index | Program List | Copyright

Copyright © 1996 by Addison-Wesley Publishing Company, Inc.