Inspiration-Driven Development

I want to talk a little about inspiration.

The act of programming is of a very creative nature. Abstract concepts like data structures and algorithms get crystalized to code, seemingly created ex nihilo. Where first there was nothing, there is now a file of source code.

Writing code can be an exhausting occupation, and sometimes frustrating. It can wear you out emotionally and physically. But when you’re in the zone, just going with it and letting code flow from your fingers, there’s nothing quite like it. I once tried to describe the allure of coding as “Kind of a cross between knitting and crossword-solving”, by which I mean a highly intellectual activity that’s also half handicraft. My girlfriend, both a crossword enthusiast and a needlework afficionado, understood completely.

Unfortunatly, I find myself spending far less time doing actual development work than I’d like to, and I think this is a common complaint among programmers.

Real Life

The company I work for employs about 60 people, but only five of us work for the IT department. So, we’re a small team that are expected to do everything from refilling printer cartridges to maintaining and architecting the J2EE behemoth that is our web site. My business card says ‘Systems Developer’, but in reality a large part of my job seems to be to figure out what my job is. I do sysadmin stuff, Java coding, CSS troubleshooting, customer support, system integration, even business development on occasion. There’s a lot of non-programming stuff going on, I get a lot of email, and I tend to spend a substatial amount of time on the web, keeping up with current events.

This used to bug me a lot. I resented the constant interruptions, the emails, the meetings. “Why pay me to work here when you won’t let me do my job?” I used to mutter. I loathed myself for wasting company time surfing the web. The stress was getting to me. But lately I’ve come to realize one important thing:

Even the non-coding activities are a part of my job as a developer.

Listening to suggestions, responding to criticism and above all, managing expectations, is crucial. Reading tech blogs is a part of my job, and so is taking a break to slack off or go for a walk if I need to. Because my job isn’t to just sit in front of a computer and produce code. It is to ensure that the systems we deliver are as good as they’re ever going to be.

I know some of my (non-IT) co-workers would be suprised by this. “Surfing the web a part of the job? Really, that’s just a poor excuse for slacking off. That’s like stealing from the Company!”

Just kidding, I have wonderful co-workers. But here’s the thing:

The best coding happens in the brain, long before you actually sit down to write.

I’ll be so bold as to claim that the time you’re spending at the keyboard is your least creative period. There’s too much distractions, too many things happening. You get too invested in what you’re building to think deep and hard about the underlying problem. That’s when you need to take a break, step away from the computer and go do something else.

Pro Tip

Here’s a tip: my favourite way of solving particularly hairy coding problems is to go sit down somewhere with my moleskine and my favourite pen (Pilot G2 0.7mm, since you ask). I try to write down the problem as clear as I possibly can, then go about describing ways of tackling it. Usually I start with some obvious solution, then write down the reason that it won’t work. Then I come up with something else, then something else. And then suddenly the solution presents itself, like magic.

This method has worked, without fail, every time I’ve used it. But you can’t cheat. You need to get away from the computer, and you need to write things down. By hand. I don’t know why, but I suspect the act of writing activates a part of your brain you wouldn’t otherwise be using.


I’ve found that when the stars are aligned correctly I’m at my coding peak between 3pm and 7pm. There seems to be very little I can do about that; earlier in the day my thoughts are too scattered for me to be of any use, and later in the evening I get too hungry to focus on anything but dinner. The sad part about this is that when I’m not working from home I have to leave the office at 5pm in order to catch my train. That leaves about 2 hours of productive time a day.

I’ve come to accept that, and started structuring my day to accomodate this fact instead of fighting it. Before lunch I respond to mail, make notes, read blogs, get the facebooking out of the way, try to check out any bug report we’ve received, return calls to customers who are having problems, etc. Basically, I’m trying to remove all the obstacles that will impede my progress when the gears in my brain finally click and I can get to work.

Some days that doesn’t happen. The magic is gone, and it feels like I can’t get anything done. That’s okay too. There’s always going to be days like that, and it usually happens when I’m stressed out or tired. Those days I do stuff that requires as little mental effort as possible. Simple code refactoring, perhaps. Following up on email. Going through old stuff on the todo list that’s been nagging me. That is, ensuring that when inspiration returns, I will be ready for it.