Transcript Pseudocode
Pseudocode
Developing Your Program Logic
What is Pseudocode
A computer program is the representation of an "algorithm" (an unambiguous set of steps, in a particular order, which when followed will solve the problem) Pseudocode is the representation of these steps in "structured English" Steps must be clear (i.e. unambiguous) Order must be specified When the steps (i.e., instructions) are followed, they must produce a solution to the specified problem
Why Develop Logic Using Pseudocode?
The alternative: just enter Java code?
logic is not clear computer language (e.g., Java) is too detailed and lengthy focus moves to language syntax is not conducive to successive refinement Flowcharts and other design tools are suitable alternatives to pseudocode
Successive Refinement
Equally applicable whether you use pseudocode or flowcharting Start at the "top" which is a one line statement of your program's purpose and break it down by stages into greater and greater levels of detail Successive refinement stops when there is enough detail to write the program Each pseudocode statement or flowchart symbol is a basic building block (like a tinker toy) these are assembled into complex structures assembled in specific ways
Applying Successive Refinement
Start with a one-line statement of the problem Break down into 3-5 steps Break down each of these into 3-5 steps Continue this process (i.e. successive refinement) until each step will become one or a small number of Java statements
Program (Logic) Planning
Look at the output (desired product) Determine what inputs are necessary to allow the creation of desired output Design the logic (steps) to collect the input and build the desired output Often this leads to a general program logic flow of input processing output
Advantages Derived from Using Pseudocode
Good tool for program logic planning Can use to review system logic with user Can document logic for system maintenance