Pseudocode Developing Your Program Logic What is Pseudocode
- Slides: 7
Pseudocode Developing Your Program Logic
What is Pseudocode z 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) z Pseudocode is the representation of these steps in "structured English" y. Steps must be clear (i. e. unambiguous) y. Order must be specified y. When the steps (i. e. , instructions) are followed, they must produce a solution to the specified problem
Why Develop Logic Using Pseudocode? z. The alternative: just enter Java code? ylogic is not clear ycomputer language (e. g. , Java) is too detailed and lengthy yfocus moves to language syntax yis not conducive to successive refinement z. Flowcharts and other design tools are suitable alternatives to pseudocode
Successive Refinement z Equally applicable whether you use pseudocode or flowcharting z 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 z Successive refinement stops when there is enough detail to write the program z Each pseudocode statement or flowchart symbol is a basic building block (like a tinker toy) y these are assembled into complex structures y assembled in specific ways
Applying Successive Refinement z. Start with a one-line statement of the problem z. Break down into 3 -5 steps z. Break down each of these into 3 -5 steps z. Continue this process (i. e. successive refinement) until each step will become one or a small number of Java statements
Program (Logic) Planning z Look at the output (desired product) z Determine what inputs are necessary to allow the creation of desired output z Design the logic (steps) to collect the input and build the desired output z Often this leads to a general program logic flow of yinput yprocessing youtput
Advantages Derived from Using Pseudocode z. Good tool for program logic planning z. Can use to review system logic with user z. Can document logic for system maintenance