Guide · Devlingo

Rubber duck debugging

Quick answer

Rubber duck debugging is a method where you explain your code, line by line and out loud, to a rubber duck or any listener, until you notice the bug yourself. Saying each step forces you to check what you assumed. The name comes from a story in The Pragmatic Programmer. Devlingo teaches the English to explain code clearly.

Updated 2 min readGambit Studio

Use without installing →Free in your browser, no sign-up

How to do it

  1. Say what the code is supposed to do.
  2. Go line by line: “Here I take the list of orders…”.
  3. Say what each variable holds at that point.
  4. Stop when what you say and what the code does don't match: that is usually the bug.

Wikipedia traces the term to The Pragmatic Programmer by Andrew Hunt and David Thomas, where a programmer explains code to a rubber duck. The duck is optional; a colleague, or writing the question down, works too.

Phrases for explaining code out loud

ExampleWhat it means
So here we fetch the user, and I'm assuming it's never null…State the assumption
At this point the list should have three items.Say the expected state
Wait, this runs before the data is loaded.The moment you find it
Can I rubber-duck this with you for five minutes?Ask a teammate to listen
Never mind, I figured it out while explaining it.Classic ending

Related: yak shaving and bikeshedding.

Practice free in the browser: pull request phrases and technical English phrases.

Learn the phrases around the word

Knowing what an acronym means is step one; using it naturally in a standup or a Slack thread is step two. Devlingo, Gambit Studio's English for developers app, has over 3,600 phrases for standups, code review, Slack, email, meetings and pull requests, ten new ones a day with real context and pronunciation guidance, plus a widget with the phrase of the day.

Sources

  1. Wikipedia: Rubber duck debugging

Frequently asked questions

What people ask most about this, answered with the source.

Why does rubber duck debugging work?
Explaining step by step makes you check assumptions you skipped while reading.
Where does rubber duck debugging come from?
From a story in The Pragmatic Programmer by Hunt and Thomas.
Do I need a real duck?
No. A colleague or writing it down works too.
DevlingoLearn tech phrases & speaking
Use without installingGet