Software programming is a very mentally intensive activity. In any non-trivial software system the coder has to juggle a large number of mental models. Like a juggler, a coder, has to mentally juggle not only the actual code that he/she is writing, but, details of the code that it is related to, the details of the data being manipulated, the possible errors to be handled, the reliability and performance of the code, it’s security characteristics, the requirement that is being implemented and it’s design and usability, etc (depending on the code there may be more to think of or if you lucky, less :-)). Unlike a juggler who generally juggles things of similar size, a coder mentally juggles problems whose complexity vary by several orders of magnitude (1 – 109).
Given all this, it takes time for coders to become truly productive when they sit down and start working on something. Once you get into the what I call the – coding zone , you find the ideas flowing through you seamlessly – coders in the zone lose sense of time and place – the problems and solutions are clear and you find beautiful code coming from your keyboard. Coding when you are in the zone is an immensely satisfying task – it’s like the zone that sportspeople talk about – when they are breaking records, it seems like they are unstoppable and every movement is a beautiful ballet…
This is also why almost all good coders HATE BEING INTERRUPTED !! Whether it is a simple phone call or even a well meaning colleague coming over to tap you on your shoulder and ask a question – the effect is the same as though the coder was invited to a long meeting. It takes time and effort to get back to being productive after the interruption.
There are several other things that contribute to this problem –
- “Open Office” plans where you are compelled to hear your neighbors conversations.
- Having one phone for several people in your area so you cant disconnect it and have to attend it on the off chance it yours.
- Conversations over information that can be sent by email or IM or SMS or any of the multitude of asynchronous forms of communication available today.
I have seen several ways to combat this –
- Some people wear head-phones to block the ambient noise and subtly indicate to people they are working on something and interruptions are not encouraged (YMMV – I have seen people ignore the subtle indication and come over anyway).
- Some people deal with all their email and IM at scheduled intervals – this way everyone gets their reply and people learn to come with the questions at those times.
- If you are lucky enough to have a cabin then disconnecting the phone and leaving a message on the door is often effective.
- Some companies even plan their meetings to happen only on certain days so everyday disruption is minimized.
- A common inclination is to work at times when no-one else is around to bother you. This is a reason why coders are night owls :-)
Another effect of software programming is burn-out… This is the opposite of being in the coding zone, but it seems to be consequence of being in one… Like I mentioned in the beginning of this post – software programming is a very mentally intensive activity. Coders have frequently felt mentally burned-out after intensive coding sessions. This happens more quickly on projects which you don’t find interesting or enjoyable. Sometimes you can continue only for a day, other times it’s a month but invariably – burn-out happens.The key is to recognize it for what it is and deal with it.
Indeed, when I previously mentioned that coders lose all sense of time when in the zone, I did not mean that they should spend all their time coding. I am not applauding coders that brag about sitting for 36 hours at a computer churning out code. Those, that spend 16 hours a day at the terminal and spend their nights dreaming about code are, invariably, the ones whose work the rest of the team has to spend the rest of the month fixing. Like in all things, there is a balance that needs to be maintained. Spending long amounts of time in intense concentration is tiring, and it is important to give things a rest. It is usually great to take some time off doing something else, like mountain biking, mixed martial arts, flying a plane or playing an instrument (these are pastimes of some of my friends :-)). Some people like physical activity others like mental activities like video games, or chess. The important thing is to have a balance. Sometimes, when you are grappling with a hard problem it is useful to stop thinking about it consciously and let your sub-conscious chew over it.
When you are no longer in the zone and are spinning your wheels, a break is the most productive thing you can do.
The Zen of Programming is being able to get into the zone and more importantly to recognize when you are no longer in it and take that break ! :-)
Update: I came across this article the other day that got me thinking about burn-out. I mentioned before that burn-out happens more quickly when doing something you don’t find interesting or enjoyable – this advise goes in spades when you are doing something you feel is morally wrong or that goes against your conscience. Guilt is a catalyst that will accelerate both the speed and the intensity of your burn-out.
IMHO if given a choice it is much more satisfying to do something you believe in at a lower salary than something you don’t at a higher one.