Lesson 1 · Unit 03
Reproduce it first
Make it fail on demand, then make it small
What you practise
- Make the bug happen on demand, shrink the input, change one thing at a time, form a hypothesis and try to break it, write the failing test before the fix
Try a question from this lesson
Pick one
A user reports that an export "sometimes produces an empty file". You read the export code for an hour and see nothing wrong. What should you have done first?
Correct answer
Find steps that make the empty file appear every time
Why
Without a way to trigger the bug you are guessing, and you could never tell whether a fix worked. A bug you can reproduce on demand is already half solved.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
The debugging loop
1. Reproduce: make it fail on demand.
2. Shrink: find the smallest input that still fails.
3. Guess: one specific hypothesis that could be proved wrong.
4. Experiment: change one thing, and predict the result before you run it.
5. Pin it: save the failing input as a test, fix the code, watch the test pass.
10 more exercises in the app
- 2× type the answer
- 4× multiple choice
- 1× fill the blanks
- 1× true or false
- 1× order the lines
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.