• 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:

Your problem: Image of an angry hippopotamus. Your problem broken down into pieces: 4 cute pictures of Moo Deng an adorable baby pygmy hippo. Angry hippo image from: https://www.fotocommunity.de/photo/angry-hippo-again-huber-tom/43184827

  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