Programming Fundamentals/Introduction/Minding the Details

From Wikiversity
Jump to navigation Jump to search

One of the biggest challenges students face in learning programming is overlooking important details that are necessary for successful completion of a given program. This activity introduces the step-by-step nature of computer programming by having you plan out instructions you will ask your partner to follow to accomplish a specific task. This activity will help you understand and appreciate the level of detail required when writing computer programs.

Objectives[edit | edit source]

  • Understand the level of detail required when planning and writing computer programs.

Prerequisites[edit | edit source]

  • None

Introduction[edit | edit source]

Questions[edit | edit source]

  • How many steps do you think are necessary to make a peanut butter and jelly sandwich?
  • How many steps are necessary if you have to explain it to someone who has never made a peanut butter and jelly sandwich before?

Possible Solution[edit | edit source]

How to make a peanut butter and jelly sandwich:

  1. Get out bread, peanut butter, and jelly
  2. Open bread bag
  3. Take out two slices of bread
  4. Close bread bag
  5. Open peanut butter jar
  6. Open jelly jar
  7. Get knife from drawer
  8. Use knife to spread 2 tablespoons of peanut butter on one slice of bread
  9. Use knife to spread 1 tablespoon of jelly on the other slice of bread
  10. Put both slices of bread together with peanut butter facing jelly
  11. Cut sandwich in half, if desired
  12. Put knife in sink or dishwasher
  13. Close jelly jar
  14. Close peanut butter jar
  15. Put bread, peanut butter, and jelly away

Activity[edit | edit source]

With a partner, consider the following scenario: Assume you are sitting in a classroom. You are directing your partner to write your name on the board in the front of the classroom and then return to their seat.

  1. What steps are necessary to make this happen? Write down the steps.
  2. Compare your list of instructions with your partner's list. Discuss any differences and make adjustments, if necessary.
  3. Take turns following the directions and asking your partner to follow the steps as you read them out.
  4. If you are the partner following instructions, you can't make any assumptions. If an important detail is missing, stop and return to your seat and ask your partner to make corrections. Then try again.
  5. How many steps are necessary in order for your partner to correctly write your name on the board?

Applications[edit | edit source]

  • Compare and contrast providing detailed instructions to a partner with computer programming (providing detailed instructions to a computer).
  • Identify specific steps you will want to take when planning and writing computer programs.
  • Discuss your activity experience with your classmates. What surprised you? What have you learned that you can apply to your own school or work environment?

References[edit | edit source]