Rubber duck debugging

Rubber duck debugging (or rubberducking) is a debugging technique in software engineering, wherein a programmer explains their code, step by step, in natural language—either aloud or in writing—to reveal mistakes and misunderstandings.
The name is a reference to a story in the book The Pragmatic Programmer. It tells a story of a developer who carried a rubber duck and explained their code to it line by line.[1] Variations of the practice use other objects or even pets; teddy bears are especially common.[2][3]
Approach
[edit | edit source]Programmers often discover solutions while explaining a problem to someone else, even to people with no programming knowledge. Describing the code, and comparing to what it actually does, exposes inconsistencies.[4] Explaining a subject also forces the programmer to look at it from new perspectives and can provide a deeper understanding.[5]
The programmer explaining their solution to an inanimate object (such as a rubber duck) has the advantage of not requiring another human, but also works better than thinking aloud without an audience.[6] This approach has been taught in computer science and software engineering courses.[7][8]
In popular culture
[edit | edit source]On 1 April 2018, Stack Overflow launched an April Fools' Day joke called Quack Overflow. A rubber duck avatar appeared in the bottom right corner of the screen, listened to user problems, and pretended to type solutions, only to respond with a simple "quack" sound. It referenced rubber ducking as a powerful method for solving problems.[9]
See also
[edit | edit source]Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').
- Code review
- Pair programming
- Socratic method
- Desk checking
- Duck test
- Duck typing
- Software walkthrough
- Eureka effect § The Aha! effect and scientific discovery
- Think aloud protocol
- Pointing and calling
- Rogerian method
- Worry dolls
- Learning by teaching
- Body doubling
References
[edit | edit source]- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). p. 95, footnote.
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value)..
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).