You might also like

Letters: The tiny debugging library for Ruby
Fixing Bugs that can’t be Reproduced
Fixing These jQuery


Melanie Archer

Does the object have to be inanimate? I bet adopting this could be an additional argument for bringing dogs to work--I wouldn't mind explaining my code to my colleague's pug.

about 4 years ago   Like_icon 2 likes  
Abelardo Gonzalez

Oh, I had heard it was a code monkey! :D

Personally, I just talk to myself. :P

about 4 years ago   Like_icon 1 likes  
Jared Brown

I've felt a bit crazy in the past when I've done this sort of thing. Though it does have its advantages.

I think this is where pair programming can help. I'd feel less silly if I was explaining the problem to another developer who also may be able to help.

about 4 years ago   Like_icon 0 likes  
Dale King

I think the name is a bit of a misnomer. I think Rubber Duck Review would be a better name.

To me debugging means trying to track down a specific issue, which this is not an efficient means to do that. As I tell people the most important thing to do is to gather data and verify assumptions.

When you explain code you are still relying on your assumptions of the way that the code works. I can explain that this code does X. When I debug I want to verify did this code do X (possibly using logging or examining variables in a debugger).

Seems the outcome of this process is to make your code easier to read rather than locating and fixing defects.

almost 4 years ago   Like_icon 2 likes  
Jared Brown

That's a great point Dale. I would agree that this sounds more like a review process. It probably would be most beneficial to do at the psuedo-code or initial design phase. I tend to do this with comments and psuedo-code for hard problems now. But I don't talk through it out loud.

almost 4 years ago   Like_icon 1 likes  
Dale King

I always consider comments as the last resort. For really hard, unobvious code you should use comment. I prefer adding well named variables and methods that are named such that a comment is not necessary.

For example, if you have a few lines of code you need to explain, it is usually better to extract those lines of code into a method where the name of the method says what the code does (i.e. what you would have written in the comment).

What I am referring to is Introduce explaining variable and Extract Method refactorings first and then if absolutely necessary add comments.

almost 4 years ago   Like_icon 1 likes  

Talentopoly Newsletter

A once-weekly round-up of the best programming and design posts.

Join 2050+ subscribers

We will never spam or share your email address. Easily unsubscribe

10256594_10152616530373739_9058832982546939564_o_speck Jared_gaze_speck 15b2f7b_speck