Rubber Duck Debugging

A duck costs nothing and outperforms most tools.

▶ the lesson · narrated sketch video · tap for sound

the intro

Rubber duck debugging is explaining your code, line by line, to an inanimate listener. Saying it out loud forces your brain to state assumptions it has been skipping — and the wrong one usually reveals itself mid-sentence.

fun fact ✦

The duck never interrupts, never judges, and has fixed more bugs than most debuggers.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

Your brain is a lazy interpreter: it skips steps it has decided to trust, and bugs live precisely inside the trusted steps. Explaining out loud forbids skipping — every assumption has to survive being spoken, and the false one usually dies of embarrassment mid-sentence. The duck is not a magic totem; it is a device that forces you to run your mental model out loud, sentence by sentence, and watch where it throws.

bugs live in the steps you skip

the explanationwhat I assumewhat really runsthe mismatch
an explanation forces assumptions into the open, where they can be wrong

key terms

articulation

Turning a vague feeling into a precise sentence. Precision is where bugs get caught.

"broken" becomes "sends undefined"

assumption

Something the code relies on that nobody ever checked. The duck is an assumption detector.

the API always returns an array

the obviously moment

The mid-sentence stall when a step you called obvious turns out to be false.

"it obviously reads the config"

self-explanation

A studied learning effect: explaining material to yourself beats re-reading it.

explaining beats re-reading, per studies

how it works

  1. 1
    Pick a listener

    A duck, a pet, an empty chat draft. The only rule: it listens without interrupting or guessing.

  2. 2
    State the goal first

    One sentence: this code should do X when Y. Bugs hide inside goals nobody said out loud.

  3. 3
    Walk it line by line

    Say what each line does, not what you meant it to do. The bug lives where those two diverge.

  4. 4
    Arrest every obviously

    The word obviously marks an unchecked assumption. Stop there and go verify it in the actual code.

  5. 5
    No duck? Draft the message

    Write the explanation as a message to a colleague. If you solve it first, delete the draft and take the win.

the code, explained

the draft that solved itself before it was ever sent

1// draft to @sam, not yet sent
2The coupon code should discount
3the total, but total prints NaN.
4coupon is "10", a string, so
the assumption, finally spoken
5price + coupon = "10010"... oh.
6Number(coupon) before adding.
the fix arrived before sending

side by side

duck first

  • zero interruptions, zero judgment
  • ten minutes, no goodwill spent
  • your deep context stays warm
VS

a human colleague

  • fresh eyes catch stale assumptions
  • knows traps you have never hit
  • costs their time: bring findings
💡 tip

Keep a bug diary: one line per bug — symptom, cause, fix. After twenty entries the patterns emerge, and you will notice most of your bugs are the same three mistakes wearing different hats.

quick answers

Does it have to be an actual duck?

No — anything you cannot interrupt works: a pet, a plushie, a blank chat draft, a text file. The mechanism is you finishing the sentences, not the listener.

What if I explain everything and find nothing?

Then your stated assumptions were all true and the bug is elsewhere — you still shrank the search space. Escalate to a colleague and hand them the write-up as a briefing.

Can an AI chatbot be the duck?

Partly: it listens patiently but it also guesses, and its guesses can steer you wrong in ways a duck never would. If you use one, make it ask you questions instead of handing you answers.

quick hits about Rubber Duck Debugging

short answers · interviews, tips, trivia & hidden gems

📚 tutorial

No duck? Write it outwatch ↗

🔧 useful

Two keyboards, one bugwatch ↗

🧠 trivia

Where the duck beganwatch ↗

💎 deep

The mid-sentence fixwatch ↗