• Take a break learning commands to talk about general approaches
  • Real computational tasks are complicated. To accomplish them you need to think before you code.

Problem decomposition steps (10 minutes)

Open the following images one per tab and cycle through:

  1. Understand the problem
    1. Restate the problem in your own words
    2. Determine the inputs and outputs
    3. Ask for clarification
  2. Break the problem down
    1. Write down the pieces, on paper or as comments in a file
    2. Break complicated pieces down until all pieces are small and manageable
  3. Code one small piece at a time
    1. Test it on it’s own
    2. Fix any problems before proceeding

Breaking down an exercise (15 minutes)

  • This week we will be working on more complex exercises
  • Show end result of first exercise
  • Take time 5 minutes to read through one of the exercises
  • Then we’ll try to break it down into pieces as a class

Start simple

  1. Experiment
  2. Write a simpler version
  3. Make sure it works
  4. Make sure you understand it
  5. Modify it to make it more complicated
  6. Repeat until finished