I have noticed I have had great success using another co-worker as a metaphorical rubber duck (sometimes intentionally, sometimes unintentionally). It improves my productivity vastly and helps me rationalise my code. However, I know that it probably distracts others when I am using them in that way.
That's why I want to buy a literal rubber duck and talk to it. I could do it very quietly and most of my close co-workers use noise-cancelling headphones 80% of time while sitting at their desks. My only concern is other people passing by my desk would think that I am weird.
Is it unprofessional to talk to a rubber duck at the office?
For those outside the tech industry, this may sound slightly weird. But this is actually an effective debugging strategy.
It’s called Rubber Duck Debugging , and it goes like this:
- Get a rubber duck, the kind you’d have in a bath.
- Sit the rubber duck on your desk. Let it know you’re going to run through some code with him, if that’s cool.
- Explain to the duck what your code is supposed to do. Go through your code line by line, sparing no detail.
- At some point, you will tell the duck what you’re doing next. It’s then that you realise that is not what you’re actually doing.
- The duck will hold your secret in its rubber heart forever more.
The logic behind Rubber Duck Programming was explained in the book The Pragmatic Programmer . By forcing themselves to explain their problem in intricate detail, the programmer thrashes out a solution to the problem. "In describing what the code is supposed to do and observing what it actually does, any incongruity between these two becomes apparent."
In terms of workplace dynamics, it wouldn’t hurt to explain what you’re doing to your colleagues. They might even buy into it, bringing their own rubber ducks to work. You could end up with an office of helper toys.