Avoiding Distractions While Programming
If you have read Getting Things Done, then you can already guess what I’m about to write here: use your inbox. If you haven’t read Getting Things Done, then you need to know what I mean.
Here’s what I mean.
We have a variety of inboxes: email, phone, SMS, people interrupting us asking us to do things, and so on. When I talk about “the” inbox, I mean the composite collection of all your inboxes — the union of all your inboxes. In other words, The Inbox is the sum of all your various inboxes.
Having many inboxes creates problems, because you are continously wandering around monitoring and checking those inboxes. It feels like a game of A Dark Room, but not nearly as much fun. You need One Single Eventual Inbox into which all other inbox items flow. Periodically, then, you process The Inbox according to the universal algorithm for doing things:
- If it takes two minutes or less, then just do it, and then forget it; otherwise…
- Delete it, if you can, and then forget it; otherwise…
- Delegate it to someone else, if you can, and then set a follow-up reminder, and then forget it; otherwise…
- Defer it to a later date, if you can, and then set a follow-up reminder to start the work and set a deadline (if there really, really is one), and then forget it; otherwise…
- Add it to your list of “next actions” so that you’ll do it “as soon as you can”, and then forget it.
Very well… either you already do this or this gives you a direction to move towards. In the meantime, you want to get some work done, and you find yourself already in front of your computer, so what do you do?
Put An Inbox Beside Your Computer
You’re going to laugh. Take some paper and a pen (or pencil), and put them beside your computer. I know that you might not have these archaic implements, so I’ll wait while you find them. Now…
Before you start working, there are probably 50 things swimming around in your head. Get those things out of your head by writing them in your inbox. The previous section tells you how to handle the items in your inbox. For now, simply write them down, so that you can focus. You might write down ideas for tests, you might draw a few little diagrams for the modules you intend to create, you might even write down that you need to pick up cream and eggs and wine on the way home from the office. Whatever might distract you, write it down. Seriously. Write it all down, even if it takes ten minutes.
Now, look for items in your inbox that describe appointments, like “I have to go to a meeting at 15:30”. Take a moment to set reminders using whatever alarms or calendar apps you have. Make sure the sound is on. Set the reminders, then forget about that stuff, so you can focus on the current task.
Now, look for items in your inbox that describe microtasks related to the current task. You might prefer to write those down in a separate list, so that you’re not constantly noticing unrelated things that might distract you.
Now, open a timer app and set it for 30 minutes. Make sure that sound is on, but if you can, turn off the sound for other notifications.
Now, pick a place to start working, then start working. It might be one of the tests that you wrote down in your inbox or it might be one of the modules in a diagram that you drew. Start working. While you work, if anything pops into your head that isn’t the exact microtask that you’re currently working on, then write it in your inbox. After you write it down, forget about it and get back to the current task.
The timer will scream at you after 30 minutes. Stop working. Really! Stop. Write down in your inbox anything that you’re currently holding in your head. Next steps, ideas, hunches, the values of variables, whatever. Write it all down. Now get up, walk away for a few minutes, then come back. When you come back, scan your inbox for information about where you paused, so that you can resume your work. Set the timer for 30 minutes again and keep going.
That’s the idea.
- Work in small bursts (30 minutes) so that you get used to organizing your work into small batches and completing tasks, rather than merely starting them. If you can’t articulate a goal that you can achieve in 30 minutes, then maybe you should do something else.
- Get distractions out of your head so that you can focus on the current microtask. This allows you to complete that microtask sooner and with fewer mistakes. Once you experience this, you’ll wonder how you ever got things done before.
- Prioritize appointments over deadlines over everything else.
- While focusing on a task, minimize interruptions. Everything can wait an average of 15 minutes. If it’s a genuine, time-sensitive, life-or-death emergency, you’ll know. (If you’re on call for an emergency, such as a medical issue, then make sure people have a Bat Phone way to reach you, such as SMS/phone call with a special ring tone.)
- Take frequent breaks in order to give yourself time to relax, recover, and synthesize the work done so far. I’m still amazed at how often I realize that I wasted 30 minutes doing entirely the wrong thing. At least it’s only 30 minutes and not four hours or the whole day!
This is how I avoid distractions while programming and it feels wonderful!
David Allen, Getting Things Done. My system for finishing work.
J. B. Rainsberger, “Getting Started with Getting Things Done”. If you can’t read a book yet, then surely you can read four pages.
J. B. Rainsberger, “The Two-Minute Rule”. When a request for work finds you, if you can complete it in two minutes, then do it now; otherwise, schedule it for later.
John Kotter, A Sense of Urgency. Don’t fall into the trap of false urgency, so that you have energy to deal with truly urgent things.
pomodorotechnique.com. One specific method for restricting your work to short bursts of time. I don’t do exactly this, but I used to do exactly this, and it helped me develop some of the discipline upon which I now rely.
followupthen.com: A wonderful service for both following up on emails and setting reminders for yourself. Tell them that jbrains sent you.