Thursday, May 23, 2013

Cooking and Coding


Recently I have been doing a lot of coding. At times I feel its a drudgery one goes through. But at times I do feel good about getting some output which I wanted for a while. When I deeply tried to understand  the drudgery part, I found that it is the mindless mistakes I do and later try to debug and fix them while testing that is causing this effect within me.

Coding requires a lot of discipline to get something going the first time itself. One should not be disturbed by external noises around you. Silence outer and most importantly inner is the key. Have a good swim or a jog before sitting for coding which helps a lot to focus.

Yes, a lot of focus is needed as it requires all your attention to stare at the monitor, work through the logic and steer it in the way you want the output. When your mind slips, you make errors and then go through the pain of debugging and testing.

When your attention is not there for a moment, you end up mindlessly copy pasting some other code which may look similar and that is what you need in the current portion you are doing without thinking the modifications it may need to fit in this one. Then a lot of errors and debugging ensues.

Do things slowly and with full attention. Do little, but understand what you are doing fully and then place the lines. I assure this way you will make less mistakes and programming becomes less tiring.

I mentioned cooking in my title. So you must be waiting to hear the comparison. And here I go. The drudgery in cooking is not cooking itself. Like coding something to see an output cooking for a great smelling dish is a delight.

The pain is in cleaning the dishes and doing all the housekeeping chores that makes it difficult. How much ever you try writing a error free code first time it ends up with bugs. Similarly doing cooking without dirtying the place is difficult.

Of course since code is not a 'matter', it does not perish while cooking perishes unconsumed if a bad job is done. Cooking smells while coding is non smelly.

Now you may wonder where the heck is this blog going? I join you. I thought there is something in common between the two. Ah! one thing that is probably common is in coding as well as cooking you have this art of delegation. In office, you have these supervisory souls (or roles) that does not wet their hand but get a lot done from lesser mortals. Same happens at homes where those very same sup. souls end up delegating the cooking to ladies and end up relaxing with a newspaper or pretending to work and browse the web instead.