What is rubber ducking?

If you ever come across a programmer in deep conversation with a rubber duck, do not be alarmed. They are probably just looking for bugs in their code with a popular debugging technique called rubber duck debugging.

Rubber duck debugging or rubber ducking for short, is a way of debugging code through explaining it to a rubber duck. The seemingly absurd technique originated from a story in The Pragmatic Programmer and is extremely useful.

Despite the name, rubber ducking can be done with any inanimate object.

Debugging can be a very toiling task. Logical errors like:

  • forgetting to call a function
  • using an incorrect logical operator
  • running an extra iteration in a for loop

These errors can be challenging to spot even after spending hours scanning a program. Rubber ducking allows a programmer to slow down and describe their code in the simplest way possible. By breaking their program down, programmers are able to have a new perspective that makes it easier to catch bugs they may have missed earlier and remove any junk code in their program.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved