December 31, 2006
Overcoming Coder’s Block
For my entire programming career (that is to say, my whole life), I’ve been searching for a solution to what I call “Coder’s block”. Roughly half of the days I sit down in front of my editor I find that I simply can’t get started. I’d imagine anyone who has been coding for longer than a week will agree that the most difficult problem is often simply finding out where you (or the guy before you) left off yesterday, last month, last year, or before you took out the garbage. Once you know where to start, the how falls into place by itself.
I can only speak for myself, but during this reacquaintance stage I’ll often get distracted by just about anything. Usually the culprit is Bloglines, Thunderbird, Gaim, or any other application that pops up to notify me of something going on. Giving into these temptations is suicide. I can literally get sucked in and spend an entire day accomplishing absolutely nothing.
Writer’s block is easy by comparison - simple techniques like freewriting and mindmapping can help to keep you focused and free of distraction. But what techniques can be of use when writing software?
What works for me:
- Create a work environment with as much artificial light and as little clutter as possible. I don’t know why, but sunlight is actually more laziness-inducing than darkness for me - I keep the blinds closed. Unfortunately I’m a bit of an ogre by nature so often removing said clutter could be as much of a day-long distraction as anything else.
- Go full-screen and kill any processes that intrude by popping up. Setting the taskbar to auto-hide (if you use Windows) may also be helpful.
- Take a few minutes to read a relevant article or book passage - there’s very little more motivating than discovering a new technique, but make sure it’s one that can be put to use in the project at hand. It’s far too easy to end up with a thousand unfinished sideprojects if the technique requires starting something new to try it out. It may be beneficial to set a timer if you’re at risk of getting sucked in.
- Avoid social news websites (such as digg) at all cost.
- If you’re the kind of guy who always seems to have a thousand browser tabs open, try using the session manager in Tab Mix Plus to keep unrelated tabs out of sight and mind while you’re working. I like to have a separate saved session for each project I’m working on, and another for when I’m taking a break that has tabs like Bloglines and Slashdot.
- If you’re the type to listen to music at work, make sure it isn’t going to be a distraction. Upbeat tunes without lyrics work best for me. If you find you are frequently interrupting yourself to change tracks, remove control by tuning into streaming radio instead.
- Invest in a machine with enough RAM to keep all your work applications running simultaneously. A lot of the time all it takes to break my concentration is the 30 seconds to launch a program. This will pay for itself many times over in increased productivity.
- As a last resort, reboot your day. This is something I do not just with work, but any time a day is going so incredibly badly it just can’t be saved. Turn off the lights and take a quick nap. 20 minutes is best. When you get up, take a shower, make a small breakfast, and just go through your morning routine as if it were the first time. Try to forget anything prior even happened.
What doesn’t:
- When you’re having trouble getting started, it’s easy to tell yourself that all you need is a 5 minute break - this is probably not true. Try to save all the little break-time chores (phone calls, making a fresh pot of coffee…) for later, and knock them out all at once. If you’re at risk of forgetting them, try making a list. Once I get rolling breaks are fine, in fact I often need to give myself a couple minutes away from the keyboard to let my mind catch up.
- Avoid TV, podcasts, and games. Hopefully this one is obvious, but so many people try to ignore it anyway.
- Don’t let other people intrude. Put the phone on silent, lock the door - whatever it takes. You can get back to them later. Just a 60 second distraction can cost a programmer 15 minutes. Only programmers and writers seem to understand this concept.
What works for you? For the love of god please add anything you find helpful to the list.
15 minutes left….. 2007 here we come!

By email






















It’s really a good article! ;-p
Comment by WANG Cong — January 1, 2007 @ 2:07 am