According to MIT's software course, what should you do first when hunting a bug?

Find a small, repeatable test case that makes the failure happen.

Start playing free

  1. Rewrite the whole program
  2. Find a small, repeatable case that triggers it ✔
  3. Add print lines everywhere at random

Why: If you cannot make the bug happen on purpose, you cannot tell whether a fix worked. A small repeatable case then lets you study the data, form a hypothesis, test it, and repeat, like a scientist.

Huh, didn't know that: Explaining your code out loud, line by line, to an object is called rubber-duck debugging, and it really works.

The dad joke
Debugging is like being a detective in a crime movie where you are also the culprit.
Like this card?
Play the game

References

Answer: Find a small, repeatable case that triggers it. If you cannot make the bug happen on purpose, you cannot tell whether a fix worked. A small repeatable case then lets you study the data, form a hypothesis, test it, and repeat, like a scientist.

  1. MIT 6.031 Software Construction, Reading 13: Debugging web.mit.edu/6.031/www/sp22/classes/13-debugging
    Start by finding a small, repeatable test case that produces the failure.
    Checked 2026-10-10.

Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.

Test yourself in the game