Rubber Duck Debugging

technique · computer science · organizing-schema

Explaining a problem aloud to an inanimate object to surface its solution.

Rubber Duck Debugging is the practice of explaining a programming problem aloud, line by line, to an inanimate object (canonically a rubber duck on the desk) when the explainer cannot see what is wrong with their code. The named practice was popularized by Andy Hunt and Dave Thomas in The Pragmatic Programmer (1999), which described an unnamed colleague who carried a small rubber duck for this purpose, but the underlying technique is much older — the protégé effect (you understand something better when teaching it) is well-documented in psychology and education research, and 'explaining the problem' has been a debugging technique as long as there has been programming. The mechanism is that articulating a problem in natural language forces explicit reasoning about assumptions, intermediate states, and expected vs actual behavior that internal thinking glosses over. The duck (or any non-judgmental listener) serves to externalize the explanation without the social pressure that explaining to a colleague would create. The technique remains common practice and has had genuine influence on how engineers think about reasoning aloud, with modern variants including journaling-as-rubber-ducking, talking-to-yourself-while-coding, and increasingly LLM-as-rubber-duck (where a language model acts as the listener and may also offer responses).

Originators

Long history of practitioner technique; named codification by Andy Hunt and Dave Thomas high

Year / Decade

1999 (named codification in The Pragmatic Programmer); long-standing technique high

Primary sources

Hunt, A. & Thomas, D. (1999, 2nd ed. 2019). The Pragmatic Programmer high

Core components

Primary use case

Debugging stuck problems; preparation for asking for help (often surfaces the answer before reaching the colleague); learning by teaching practice; complement to other debugging techniques; widely-cited cultural reference in programming.

Common criticisms

Lineage

Siblings
Code Review