Outline for May 8, 2009

Reading: §9.1–9.3

  1. Overview of top-down design
    1. Sometimes called “stepwise refinement”
    2. Break problem into smaller pieces, plus the “glue” to hold them together
    3. Do the glue first, with the smaller parts being stubs
    4. Do the stubs
  2. Step 1: the program, at a high level (see rps-1.txt)
    1. Play rock, paper, scissors against the computer
    2. Define goal, being specific
    3. Define input
    4. Define high-level design
  3. Step 2: Data representation, smaller pieces, and main program (see rps-2.txt)
    1. Define the routines as stubs
    2. Do main, directly from the design
  4. Step 3: First routine, who wins (see rps-3.txt)
    1. Test it with the main (see rps-prog1.py)
  5. Step 4: Second routine, computer picks (see rps-4.txt)
    1. Be sure to print the result; useful later on, so a separate routine
    2. Again, test it with main (see rps-prog2.py)
  6. Step 5: Third routine, user picks (see rps-5.txt)
    1. Check for errors on entry, and announce results
    2. Again, test it with main (see rps-prog3.py)