Finding and fixing mistakes

Ages 6 to 8 Read together, then try alone · about 20 minutes

Read together

When a program does not work, we say it has a bug.

Finding and fixing the bug is called debugging.

Programmers test, look closely, change one thing and test again.

Do it

  1. Draw a grid of 4 by 4 squares on the floor with tape or paper. Put a toy at one end and a treasure at the other.
  2. Write instructions to move a “robot” (a person): forward 2, turn right, forward 3.
  3. Follow the instructions exactly. Does the robot reach the treasure? If not, find the bug.
  4. Fix one step at a time and test again. Swap roles.

Talk about it

For the grown-up

Debugging teaches that mistakes are normal and fixable. The word “bug” was used for faults in machines long before computers. A famous 1947 log entry taped a real moth found in a computer, which helped make the word famous.

← Previous lesson Next lesson →

Where this comes from
  • Computer Science Teachers Association (CSTA), CSTA K-12 Computer Science Standards (2017), on debugging
  • Smithsonian National Museum of American History, “First Computer Bug” (the 1947 log page with a moth from the Harvard Mark II)

Written with AI assistance and checked against the sources listed. Please read it before sharing it with a child.