3 minute read
What It Means to “Rubber Duck Debug”
Do you ever get stuck on a coding problem and, to help figure it out, you begin talking to yourself, or to a rubber duck on your desk? Just me? Okay. Well, it’s unfortunate society associates self-talk with lunacy, because this underutilized problem-solving tool is excellent for debugging.
Think about it: have you ever approached a fellow developer with a tech problem and half way through explaining it to them you magically realized the answer? It’s also at this point your ever-so-witty co-worker responds with, “Glad I could help.” It was your brain that did the solving all by itself. But how? How is it that speaking out a problem can result in its solution? There’s a psychological reason for this phenomenon and it has to do with the way your neurons associate ideas.
According to the Quarter Journal of Experimental Psychology, ‘ongoing perceptual processing’, or saying the word “chair” instead of just thinking about a “chair”, actually increases brain activity and awareness of that item, in this case a chair. Educational psychologists support this approach with research indicating that, “Students who mutter to themselves in class perform certain tasks better than quiet kids.”
In programming, this approach is referred to as ‘Rubber Duck Debugging’, coined after a programmer who would debug complex operations by explaining his code to a rubber duck that sat on his desk. If you don’t have a rubber duck handy, you can still use this self-talk approach to solving problems. However, we understand trying this mental trick may raise suspicious eyebrows from your co-workers.
To help you solve problems faster while avoiding awkward glances, we’ve put together 5 ways you can fit self-talk into your workplace:
- Put on a headset and pretend you’re on a conference call.
- For those who give you questionable looks, mention that Einstein notoriously muttered under breath. If he did it, so can you!
- Pretend you’re listening to rap and replace the lyrics with your issue.
- For Example:
Why’s there a null reference error on this line
am I wrong if it’s not related to DateNow or DateTime
am I wrong if I wanna get it on til’ I die.
- For Example:
- Hang this motivational quote from Oscar Levant at your desk:
- Schedule a meeting with yourself. Book a conference room, or go to an empty office, and talk out the problem to yourself.
So, the next time you get stuck, remember that talking to yourself (or a duck) can help your brain see the problem more clearly and arrive at a solution faster than if you were to keep mulling it over silently.
Happy Quacky De-Bugging!