Students in many subject areas receive instruction in specific problem-solving methods. For example, business students are encouraged to follow a systems approach to problem solving; engineering and science students are encouraged to follow the engineering and scientific method. Although these problem-solving methods are associated with very different fields of study, their essential ingredients are quite similar. We will describe one such method below.
This book is concerned with a particular kind of problem solving, namely, developing solutions that use computers to get results. We mentioned earlier that a computer cannot think; therefore, in order to get it to do any useful work, we must provide a computer with a program that is a list of instructions. Programming a computer is a lot more involved than simply writing a list of instructions. Problem solving is an important component of programming. Before we can write a program to solve a particular problem, we must consider carefully all aspects of the problem and then organize its solution.
A software developer is someone who is involved with the design and implementation of reliable software systems. This title emphasizes the fact that programmers, like engineers, are concerned with developing practical, reliable solutions to problems. However, the product produced by a software developer is a software system, rather than a physical system.
To highlight the analogy with engineering, some people refer to this method as software engineering and to software developers as software engineers. To emphasize the fact that one need not be an actual engineer or even an engineering student to develop good software, we use instead the terms software development and software developer in this book.
If the first three steps in the list above are not done properly, you will either solve the wrong problem or produce an awkward, inefficient solution. To perform these steps successfully, it is most important that you read the problem statement carefully before attempting to solve it. You may need to read each problem statement two or three times. The first time, you should get a general idea of what is being asked. The second time, you should try to answer the questions:
The answer to the first question will tell you the desired results, or the problem outputs. The answer to the second question will tell you the data provided, or the problem inputs. It may be helpful to underline the phrases in the problem statement that identify the inputs and outputs.
As indicated above, the design phase is often the most difficult part of the problem-solving process. When you write an algorithm, you should first list the major steps of the problem that need to be solved (called subproblems). Don't try to list each and every step imaginable; instead, concentrate on the overall strategy. Once you have the list of subproblems, you can attack each one individually, adding detail or refining the algorithm. The process of solving a problem by breaking it up into its smaller subproblems, called divide and conquer, is a basic strategy for all kinds of problem-solving activities.
If you do not develop a proper test plan, you risk just running the program with casually chosen inputs, thereby missing important test cases which, should they arise after the program is completed and delivered, may cause the program to fail unexpectedly. A program's behavior must be, to the greatest extent possible, predictable, even if the user makes errors in operating it.
The principle of predictable performance requires that a test plan should include cases of "bad" as well as "good" input. An especially tragic, and true, story of unpredictable software is a certain cancer-radiation machine which, in treating several patients, responded to some unexpected operator keystrokes by giving the patients lethally high radiation dosages, killing them instead of treating their cancer.
The software development method can be used with any actual programming language; indeed, only the implementation phase really requires detailed knowledge of a language or a particular computer. Even the testing phase is, in industry, often carried out by individuals who do not know programming but specialize in developing good tests of programs.
In this book, you will see numerous examples of the software development method, with each step spelled out in some detail.
Copyright © 1996 by Addison-Wesley Publishing Company, Inc.