EarniculumGet early accessJoin
← All courses

Debugging: Finding and Fixing Code

A method for finding bugs instead of guessing at them: reproduce, narrow, read the error properly, and fix the cause rather than the symptom.

beginnerEnglish218 min12 lessons
Earniculum CourseBuilt and published by EarniculumContains AdsThis course may include clearly labelled advertisements. Ad activity never affects rewards.ReviewedReviewed by Earniculum

About this course

Watching someone experienced find a bug looks like intuition. It is not. It is a search executed in a particular order, and the order is learnable. This course teaches it. It starts with the loop: reproduce reliably, narrow by halving, read what is actually there, form one hypothesis, change one thing. Then how to read an error message properly, because most of the answer is usually already in it, including the crucial point that where the code threw is often not where it broke. The middle covers logging that tells you something, and the four families that account for a very large share of real bugs: off-by-one, accidental mutation, type coercion, and asynchronous ordering. Three code exercises run in the browser, each containing planted bugs you find by running the tests rather than staring at the code. It ends with the difference between a fix that holds and one that quietly moves the problem somewhere else, and with a procedure for the times you are properly stuck, which happens to everyone at every level.

What you will learn

  • Reproduce a bug reliably before attempting to fix it
  • Narrow a problem by halving, in code and in commit history
  • Read a stack trace and work backwards to where a value went wrong
  • Recognise off-by-one, mutation, coercion and async-ordering bugs on sight
  • Fix causes at the boundary rather than patching symptoms at the crash
  • Work through being stuck with a procedure instead of by persistence alone

Before you begin

  • Some JavaScript, roughly the level of JavaScript Foundations
  • A willingness to run the code rather than reason about it
  • No tooling to install: the exercises run in your browser
CREDENTIAL RECORD

What completion documents

Credential
Certificate of completion
Delivery
self study
Learning level
basic