Your IP: Unknown · Your Status: ProtectedUnprotectedUnknown

Skip to main content

Rubber duck debugging

Rubber duck debugging

(also rubberducking, rubber ducking)

Rubber duck debugging definition

Rubber duck debugging is a problem-solving technique that involves explaining the problem step-by-step to gain a deeper understanding of it. Traditionally, the explanation is directed at an inanimate object (such as the eponymous rubber duck). By articulating the problem aloud, programmers can see the issue from a different perspective or even identify the solution.

The term “rubber duck debugging“ originated from an anecdote in The Pragmatic Programmer (a book by Andrew Hunt and David Thomas), which involved a programmer talking to a rubber duck to help them understand the problem better.

See also: debug symbols, patch

How rubber duck debugging works

When programmers need to fix an error in their code but can’t identify the issue, they can try “thinking through” the problem aloud by explaining it to a listener. The programmer must explain their code and the issue in detail, line by line, as if they were teaching the listener how the code works.

As the programmer verbalizes the code, they are forced to think more deeply about the logic behind each step. By forcing themselves to look at the problem from the perspective of a naive outsider, programmers can organize their thoughts, identify potential mistakes, and understand the code flow better.

Further reading

Ultimate digital security