Junior Track Roadmap

The scientific debugging method

This course treats debugging as a four-step method borrowed from experimental science: observe the real behavior, form one falsifiable hypothesis, design the smallest test, and change one variable at a time. Every lesson follows one bug in a disposable ScratchDebugArticle model, where published? returns false even though published_at is set. Each hypothesis is tested at the bin/rails console prompt. Two hypotheses are falsified, and source_location leads to a stray ! that inverts the result. The final lesson replays the whole session in order.

What you'll learn

  • ✓Why random code edits fail as a way to debug
  • ✓Recording what was called, what was expected and what came back
  • ✓Writing a hypothesis precise enough to be proven wrong
  • ✓Designing the smallest test that answers one hypothesis
  • ✓Testing one variable at a time at the Rails console
  • ✓Finding a method's definition with source_location and confirming a fix
Free preview · Lesson 1 3 min read

Guessing isn't debugging

Picture a bug: article.published? returns false when it's supposed to return true. A common first move is changing something and rerunning it: add a .presence here, swap nil for false there, reorder two lines, sprinkle a puts and squint at the output. Four edits later the bug is still there, or…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...