How often does this happen, you begin debugging a section of code and find you’d left comments. “Aw yeah, nice” you think. This should be easy. Only you open the comments and find any combination of the following:
– “//It works. Don’t touch it.”
– “//Mike wrote lines 168-191.” (Mike no longer works there.)
You make a promise to start leaving useful and actionable comments. Next time. Sigh.
Enter ducky debugging.
The premise is simple: you empty your hands and clear your desk to make room for a small, rubber duck. Set aside any and all distractions.
Then debug to your duck. Speak aloud and walk him through every line of code. The in-congruent buggy code will reveal its mysteries as you state each line’s purpose and then its actual output. You’re not crazy. At least this is what we do, and we don’t think we’re crazy. There’s a Catch-22 here, surely.
Our subconscious inner monologues evolved as a way for us to internalize dialogue and prevent others from hearing our own crazy-talk. The act of speaking uses areas in the brain also associated with listening. In fact, the brain allocates several different areas with language, not just one. Psychologists can back this up with a handful of empirical studies, too. Simply opening your mouth and phrasing the problem with proper syntax and sentence structure is a wholly different thought process from analytical thinking.
It doesn’t matter with whom you share your troubleshooting secrets. Not everyone gets along with a ducky. Maybe use a walnut. A squad of plastic army men. Stephen Baker’s hysterical cardboard cutout dog. Just make sure it’s nothing with an outside purpose, like a stapler, which could be absent performing perforator duties at a critical breakthrough moment. A potted cactus. A pair of antlers. We have those.
Sometimes you need to step a little further out of the box to solve a problem in our industry. The mystical powers of confessional debugging will surprise you; find a debug buddy today. After the first successful squash, your facepalm will be heard all around your office.