Rubber duck debugging

From Wikipedia, the free encyclopedia

A rubber duck in use by a developer to aid code review

In software engineering, rubber duck debugging (or rubberducking) is a method of debugging code by articulating a problem in spoken or written natural language. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line by line, to the duck.[1] Many other terms exist for this technique, often involving different (usually) inanimate objects, or pets such as a dog or a cat. Teddy bears are also widely used.

Many programmers have had the experience of explaining a problem to someone else, possibly even to someone who knows nothing about programming, and then hitting upon the solution in the process of explaining the problem. In describing what the code is supposed to do and observing what it actually does, any incongruity between these two becomes apparent.[2] More generally, teaching a subject forces its evaluation from different perspectives and can provide a deeper understanding.[3] By using an inanimate object, the programmer can try to accomplish this without having to interrupt anyone else. This approach has been taught in computer science and software engineering courses.[4][5]

In popular culture[edit]

The Stack Exchange rubber duck avatar featured on 1 April 2018

As an April Fools' Day joke in 2018, Stack Exchange introduced a digital rubber duck on their websites, branded as a new feature called Quack Overflow. The duck appeared at the bottom right corner of the browser viewport, and attempted to help visitors by asking them to speak their problems into the microphone before responding with solutions. However, the duck merely produced a quack sound after apparently thinking and typing.[6]

See also[edit]


  1. ^ Hunt, Andrew; Thomas, David (1999). The Pragmatic Programmer: From Journeyman to Master. Addison Wesley. ISBN 978-0201616224. p. 95, footnote.
  2. ^ Baker, SJ, The Contribution of the Cardboard Cutout Dog to Software Reliability and Maintainability.
  3. ^ Hayes, David (25 June 2014). "The Psychology Underlying the Power of Rubber Duck Debugging". Press Up via Internet Archive. Archived from the original on 9 July 2014. Retrieved 10 September 2021.
  4. ^ Attwood, Jeff (2012). "Rubber Duck Problem Solving".
  5. ^ Malan, David (2020). "Rubber Duck Debugging in CS50 IDE".
  6. ^ "Stack Exchange has been taken over by a rubber duck!". Meta Stack Exchange. 31 March 2018. Retrieved 1 April 2018.

External links[edit]