Sunday 1 June 2008

The Cost of Interruption

You've probably noticed, if you've been reading this blog on a regular basis, that I have periods where I write a large number of entries - followed by quieter times, such as now.

Unfortunately, this isn't just restricted to the blog: my UnAngband co-developers have to put up with extended periods of absence, followed by short spells of coding frenzy.

Recently, I've found myself unable or unwilling to commit enough time to UnAngband - following what you might assume is a typical procrastination pattern: I've been gaming, blogging and working on the PCG Wiki instead of writing code.

This is mostly to do with personal commitments: for instance, my wife and I are moving into a house this weekend: we're finally on the property ladder, and prior to that I've been 'on the road' with work for 4 weeks, travelling around Australia and New Zealand doing training and seminars - which is mentally draining, if not exhausting.

But with all this happening in the background, it's not a lack of time which has caused coding to fall by the wayside. But the time I have available has been broken up into smaller chunks, and generally I've had less periods I've been able to focus exclusively on one thing. And this is the crux of the problem.

With coding, if I have a longer period of time, I'm more productive. Not as in twice as productive, but probably ten times or more. This follows the pattern found a study in the 1960s by Sackman, Erikson, and Grant which found huge variance in individual programmer productivity. The reason for this is the time required to rebuild the mental model of the program before I can generate new, productive code. This mental model doesn't have to be complete, but it does have to be correct, and I've inadvertently introduced logic bugs that have persisted for years, due to faulty assumptions about how a particular section of code works.

As UnAngband becomes more complex, and as the number of contributing programmers rise, the total cost of rebuilding this mental model gets higher and higher.

But what I've also found, is that there is a significant cost associated in tearing this model down as well. As the more complex the model gets, the more it displaces regular social functions, like being polite and pleasant to be around. So as a consequence, any time I'm in the middle of coding, and get interrupted, I end up being a moody sonofabitch, which is hardly fair on the people around me.

It gets so bad, I have felt like being physically wrenched out of the code space, when I've been interrupted some times. I don't know if this feeling is unique to me - certainly, my father likes to take all his holidays at once - in fact the whole of February off, which suggests to me he experiences a similar switching cost between working and relaxing.

So rather than plain procrastination, blogging and gaming has become activities where I feel productive in a short term without experiencing this mind numbing interruption cost - the interruption cost of a blog entry is just re-reading the entry I've written so far, which is a much lower barrier.

It has got so bad recently that I've started dreading coding, in so far as the idea of doing something half-way and getting interrupted is a feeling I don't particularly want to experience.

My question is, is this something that you've experienced? Am I just over emphasizing the problem, and underneath it all is just standard procrastination?

submit to reddit


Kleedrac said...

No, you are definitely not the only one. I, too, become an asshole if I'm interrupted while attempting to code something meaningful. Sadly this includes things like eating :P Don't have much else to say but just wanted to make sure you know you're not alone :)

Ryan said...

I don't think I get cranky, or anything, but I do avoid writing code when I feel like I'll be interrupted. Unfortunately, this has caused me to stop writing code for quite a long time, since I'm in school.

Nick said...

This is very much something I've experienced. My way of dealing with it is to never try and code when I should be doing something else. This sounds the opposite of what's required, but it actually works for me - because it gives me incentive to do the necessary RL stuff efficiently, and means that when I sit down to code it's less likely that I will be interrupted. It also means that it takes the conflict of "code or not code" out - if there's a question, the answer is no. I guess the theory is that the frustration of the interruption is much more destructive than the actual interruption.

Also, I keep in mind something Jeff Greene said a few years back - "I try to fix at least one NPP bug every day". Just keeping slightly in touch with your project makes it so much easier to pick up when you do have time.

Above all, remember that you're doing this for fun.

Simen said...

I'd wager this is quite common for big, mental work projects. I don't get irritable, exactly, but certainly distant and antisocial. My coding is crude enough that I manage to keep it on a purely fun level, but I write fiction for a living, and a "good" working period to me usually invovles sitting up to 16 hours a day for several weeks. The rest of the world just becomes a blur that I can not relate to in any meaningful way.

Mikolaj said...

I felt the same as most of you during the (numerous) years when I was coding, proving and writing (the last one the least) my PhD. Now that I only do casual coding (random bug fixes, various scratches to my little itches, etc.) the cost of reentry is just 'svn diff' which lets me see what I've been interrupted in. Happy times. :)

Qwertyuiopas said...

Although I am still in high school, I have experienced this while modding a game based on a scripted engine(my venturings with C aren't complex enough to be a problem) to the point that it is sometimes impossible to continue working on the most complex topics, or it takes half an hour or more to figure out how I want something to work before I get around to doing it.

Andi said...

I get that terribly, and it's why Angband 3.1 is so delayed. It's been a long long attempt to take in the current state of item generation (which includes the algorithms used and the object list as a whole), which was originally designed in the 80s, with lots of historical oddities and some fifteen years of tweaking, and design a model around it which a) has vision and b) works better in some vague, unquantifiable, and subjective ways. As you say, if you get interrupted from that, the model breaks down and it takes a large chunk of time to get back into it. Because of the largeness of the task, I basically have to set aside weekends. It takes up to half a day to get my head into the space again and then I just stay there until Sunday night, minus sleep and food. Not really that healthy, and the more weekends I've spent there the less I've wanted to go back.

Your post is also relevant to how I stack up email/newsgroup/forum feedback on a particular issue before replying to it all at once: it helps me get a better mental model of what people think and want.

Dave said...

Oh, you've definitely described my thought processes and interactions as well. The new Kharne is probably a 10% of the size of Unangband, and I'm already starting to feel the way you are.

Unknown said...

This is exactly the same for me. When my responsibility of my daily job changed from being a simple developer to being the chief developer and software architect, this also happened to me. I spend more and more time in meetings, people came to me asking questions and so on. And I experienced a drop of my productiveness from lets say 90% (its impossible to be productive the whole day. anyone who tells sth different either is lying or has a wretched self-perception) to sometimes under 25%. I was constantly interrupted from coding and everytime I was interrupted I had to remember what I was doing the moment before. There where days when my working didnt exceed the stage of finishing my design idea... So, no you are not alone.