How to do it
- Say what the code is supposed to do.
- Go line by line: “Here I take the list of orders…”.
- Say what each variable holds at that point.
- 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
| Example | What 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.