Outline for February 27, 2012

  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
    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
    1. Define the routines as stubs
    2. Do main, directly from the design
  4. Step 3: First routine, who wins
    1. Test it with the main [rps-prog1.py]
  5. Step 4: Second routine, computer picks
    1. Be sure to print the result; useful later on, so a separate routine
    2. Again, test it with main [rps-prog2.py]
  6. Step 5: Third routine, user picks
    1. Check for errors on entry, and announce results
    2. Again, test it with main [rps-prog3.py]

A PDF version is available here.
ECS 10, Basic Concepts of Computing
Winter Quarter 2012