Pseudocode Developing Your Program Logic
What is Pseudocode zA computer program is the representation of an "algorithm" (an unambiguous set of steps, in a particular order, which when followed will solve the problem) zPseudocode is the representation of these steps in "structured English" ySteps must be clear (i.e. unambiguous) yOrder must be specified yWhen the steps (i.e., instructions) are followed, they must produce a solution to the specified problem
Why Develop Logic Using Pseudocode? zThe 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 zFlowcharts and other design tools are suitable alternatives to pseudocode
Successive Refinement zEqually applicable whether you use pseudocode or flowcharting zStart 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 zSuccessive refinement stops when there is enough detail to write the program zEach pseudocode statement or flowchart symbol is a basic building block (like a tinker toy) ythese are assembled into complex structures yassembled in specific ways
Applying Successive Refinement zStart with a one-line statement of the problem zBreak down into 3-5 steps zBreak down each of these into 3-5 steps zContinue this process (i.e. successive refinement) until each step will become one or a small number of Java statements
Program (Logic) Planning zLook at the output (desired product) zDetermine what inputs are necessary to allow the creation of desired output zDesign the logic (steps) to collect the input and build the desired output zOften this leads to a general program logic flow of yinput yprocessing youtput
Advantages Derived from Using Pseudocode zGood tool for program logic planning zCan use to review system logic with user zCan document logic for system maintenance