9.02.2012

Use toys

The funny part of being a grown up is that you earn enough money to buy every toy you want. I’m not talking about cars, consoles or fancy HDTVs (even if those are kind of toys for adults) but real toys.
I’ve always loved toys, from Lego / Playmobil / TMNT plastic stuff to fancy electronic toys like remote controlled helicopters. Because I can't live in a place without a Mr. Potato head or an action figure, people keep using the "geek" word on me (and I hate the way people use this word).
As you can imagine, my office at home is full of these little dolls and action figures, and when I go work at the coworking space I usually go to, there is often a Mr Potato head near me in my bag (don't tell, nobody knows, people there still think I am a normal guy).

Anyway, the other funny part with toys when you don't actually "play" with them is that they can definitely help you work more efficiently. This is the rubber duck debugging technique.

I only met one or two people in the companies I worked for who actually knew this technique, and it always seems weird to me that not every programmer use this thing. Maybe they're not as often harassed with bugs as I can be. Anyway this is a pretty efficient debugging technique.

When you're stuck with a bug, and you can't resolve it because it seems stronger than you, just call a friend: take a rubber duck. Then you just have to explain to your little buddy what you intend to do with this buggy piece of code. Once you've done that, you explain him every line of your code in detail.
And generally, while you're at the middle of a sentence, the light hits you right in the head and you know where your bug is coming from.
Generally you throw your duck in the air and jump on your keyboard to fix the mess, but science showed us it clearly depends on the programmer's personality.

I used to use this technique a lot while I was working for Ubisoft, mainly because I hate to disturb people almost as much as I hate to be disturbed while I'm coding. When I came at work with Mr. Potato Head Optimus Prime edition the second day of work, everybody looked at me as if I was coming from another planet... and it was even worse the first time I spoke to Optimus...
So, if you intend to use this technique in a company, do not hesitate to warn your colleagues before. They will laugh at you, you have to be prepared, but once that’s done, they will surely try it secretly at home. And when they discover how powerful it can be nobody will ever laugh at you again. If they do, bring a toy tougher enough to kick their ass (that's why I chose Optimus).

As I often work at home I use several toys to help me in my everyday bug chasing quests. Depending on the level of difficulty I ask different friends.


Mr Potato - Vader for small bugs
Mr Potato - Optimus for medium bugs

Batman for ultimate bugs you can't resolve
without the world's greatest detective on your side
The main purpose of using such technique in a company is to avoid disturbing other programmers when you can obviously find your own errors 85% of the time. It's your bug actually, there is no reason you can't find it. You create : you find.
Also, when you are indie you're often the unique programmer of the team or the only one not being freelance... then it helps you to find bugs by yourself when you actually are alone. Before posting on forums or stack overflow do not hesitate to talk to your little friend made of plastic.

Warning: If your toy answers you, and even more if it's a clever answer: do not listen to him and go to bed immediately. Please.

2 comments:

  1. Finally, the toys blog! :) Though awww! I wanted to see more pictures! I dont' know which one I like more, between Vault Boy, Joker, and Batman.

    I knew the rubber duck technique, but I have to admit I never used it. Sooner or later I will give it a try.

    Now my two-cents anecdote about toys. I work from home now, but for years I worked at a company. After a while, I started bringing some toys there (they still have them), and even bringing some for others. Initially, they treated me like a geek, but in a funny way (all my co-workers were very nice and full of humor). After a while, they started to bring new ones, and I'll never forget the day I came to work and my favorite toy (can't remember what it was) wasn't there. After a while, a delivery guy comes in the office and gives me a sealed envelope. Inside, I found a message written with cutout newspaper letters saying something like "We have him. Buy ice-cream to whole office, or bad things will happen", and a polaroid of my toy, with a white gloved hand threateningly holding scissors around its arm. Luckily, I bought ice cream and the toy came back, along with the laughing kidnappers, and no casualties :D

    ReplyDelete
    Replies
    1. That's funny because the exact same thing happened to me. One day I found a toy's arm on my desk... the rest of the Potato was missing. A mail told me "be kind with your co-workers and nothing bad will happen". :)

      Delete