4.1.10 Identify pre-planning in a suggested problem and solution.
Analyze: Understand (define) the problem
Specification: Specify the problem that the program is to solve
Develop algorithm: Develop logical sequences
Test algorithm: Follow the steps as outlined to see if the solution truly solves the problem
Translate the algorithm (the general solution into a programming language)
Have the computer follow the instructions. Check the results and make corrections until the answers are correct.
Use: Use the program
Maintain: Modify the program to meet changing requirements or to correct any errors.
The methodology for designing algorithms can be broken down into four major steps:
Understand the problem! List the information you have to work with. This information will probably consist of the data int the problem. Specify what the solution will look like. If it is a report, specify the format. List any assumptions that you are making about the problem or the information. Think. How would you solve the problem by hand? Develop an overall algorithm or general plan of attack.
The listing of the mains tasks is called the main module. Use English or pseudocode to restate the problem in the main module. Use tasks names to divide the problem into functional areas. If the main module is too long, you are including too much detail for this level. Introduce any control structures that are needed at this point. Re-sequence the subparts logically, if needed. Postpone details to lower levels. All you have to do in the main module is to give the names of lower-level modules that solve certain tasks. Use meaningful identifiers.
There is no fixed number of levels. Modules at one level can specify more modules at lower levels. Each module must be complete, even if it references unwritten modules. Do successive refinements through each module until each statement is a concrete step.
Plan for change. Don't be afraid to start over. Several attempts and refinements may be necessary. Try to maintain clarity. Express what you think simply and directly.
NOTE: The problem-solving strategy that parallels Polya's outline is known as top-down design. It produces a hierarchy of tasks to be solved.