When I was first introduced to the concept Rubber Duck Debugging, my eyes lit up with wonder. Ducks? At work?! What is this fantastical madness?! I imagined developers with piles of ducks surrounding them, something like this person's desk perhaps...
Although a Duck Army is a bit extreme, it's not entirely uncommon to find at least one developer in any given team who has a rubber duck or three.
If you aren't familiar with this concept, you're probably wondering "What in the literal heck do rubber ducks have to do with software development?" You would be staring at me incredulously and probably chalk me up to being a loony. Well, let me explain so you can get in on the secret to some fantastic debugging productivity!
Rubber Duck Debugging, Explained
Imagine, if you will, a sneaky bug that you just cannot put your finger on. Your IDE has been less-than-helpful and you've read the suspect code top to bottom for the last 20 minutes; everything looks like it should work how you'd expect but it doesn't! You call a teammate over and ask them to hear you out for a minute. As you read through the code verbally, explaining to them every detail and decision, suddenly the bug LEAPS out at you. It was so obvious!! You probably smack your forehead, thank your coworker, they walk away chuckling at you, and you make the change that fixes the bug.
Now consider the fact that even though we love to help one another, we're all busy and have timelines to meet. What if we could mimic that "aha" moment that hits us by articulating each piece of code line by line without the human who has to stop what they're doing to listen? Enter the Duck. You can read the code to your happy little duck friend, be it a pirate, astronaut, devil, or not a duck at all (we support equal-opportunity debugging pals). Just as your coworker didn't have to say a single word, neither will your duck. The important part is reading and explaining everything as though it is actually listening - it won't work if you gloss over the details like you did in your mind the first 26 times you read it. Talk to the Duck.
Bonus Points: You can pretend your duck is at a Kindergarten comprehension level and practice explaining your code in more simple detail, a skill many developers could use some work in.
I recommend you go find yourself a duck or two! Have fun with it, find yourself a new debugging buddy!