Monday, March 17, 2014

Rubber Ducky, You're the One...

Rubber duck debugging is honestly one of the most useful and, at the same time, easy to do debugging methods I've ever used.  The name is inspired by a story from a book, The Pragmatic Programmer, in which a developer is mentioned to carry around a rubber duck.  He would explain his code, line by line, to the duck whenever he was stuck solving a problem.

In my life I don't carry a duck but I do have my boss, a highly organized non-programmer who politely nods his head as I explain my code and more often than not during the process of telling him where I'm stuck, I tell myself what I've been missing.

Just remember, you're not dumber than the problem you're trying to solve, you most likely keep overlooking it, and when you go line by line to yourself, you skip it again and again.  If you have a patient boss or coworker, run it past him, if not, go to a private room and tell the pencil you're holding everything about the code, line by line.  Will it always solve your problems?  No, of course not.  Will you look absolutely ridiculous?  Of course!  But if it works even some of the time, isn't that the start to not making the same mistake again next time?

No comments:

Post a Comment