As with any other activity, programming “well” isn’t just about technical knowledge; it’s also about knowing how to work effectively in an environment where we’re increasingly afflicted by a flood of devices and apps competing for our attention around the clock. Unless you take steps to prevent it, they end up consuming much of your time unproductively and, worse, making it impossible to focus on a task for more than a few minutes.
We’re facing a 21st-century illness: an increasing inability to maintain attention and concentration.
A few weeks ago, I read this article, which I recommend: “Focus and Deep Work — Your Secret Weapons to Becoming a 10X Developer”. It discusses techniques for programming not only better but faster. I’d like to add some of my own thoughts, because one thing I can confirm unequivocally is that the best-performing teams and projects aren’t the ones that work the longest hours—they’re the ones that work better.
Fact #1: Any creative task requires a high level of concentration.
And we already know that programming well is more than an art.
Some time ago, I read Cal Newport’s book Deep Work: Rules for Focused Success in a Distracted World (it’s in English, but there’s a Spanish-language summary). It argues that attention will become an increasingly scarce resource, so the best—and most sought-after—professionals will be those who manage their attention and ability to concentrate most effectively.
I couldn’t agree more. When I look back at how people worked fifteen years ago, or at the beginning of my career, I see a lot of differences. Not so long ago, there were far fewer opportunities for distraction and interruption. We were, let’s say, less scattered. To fill the odd idle moment on the metro or bus, we had a newspaper, a book, or an MP3 player. Now we carry a smartphone that gives us all of that and much more in the same device, including an endless supply of options, distractions, interruptions, and ways to waste time.
Fact #2: Try putting your phone in airplane mode for an hour and programming offline with only your IDE open. Do you feel nervous or as if something is missing? That’s a bad sign.
We live with unnecessary stress from interruptions that almost never offer us anything useful, confusing entertainment with knowing how to work well. It’s true that we can control interruptions to some extent, but realistically, few people do. A notification from your friends or partner, breaking news, or your cousin’s latest Facebook message pulls you away from the boring task you’re doing for a moment. It seems to make the day more enjoyable, but you don’t realize that you’ve barely been able to concentrate on anything. As a result, something you could have finished in an hour takes several, with a disastrous cumulative effect over the month.
Fact #3: You pay a very high price for constant distraction, even if it isn’t obvious.
For software developers, this effect is devastating. We have to make design decisions continually (micro-designs), stay alert to opportunities for refactoring, and so on. Our work is also largely cumulative: we build software on top of what we did yesterday, the day before, and so on.
Fact #4: The better you are at staying focused, the better software you’ll write. That’s all there is to it.
Some people can stay in that state of mental immersion for an hour at most; others can manage two or three. It takes us an average of twenty minutes to regain our previous state of concentration after losing focus. If we know we can only do good work—and do it in less time—when we’re focused, then protecting that focus is essential.
Many things can prevent us from working with focus (perhaps these sound familiar):
- Phone calls.
- An overly chatty colleague sitting nearby.
- Constant notifications on your phone or in your operating system’s taskbar.
- Impromptu meetings.
- Keeping your email client open all the time and watching for new messages in your inbox.
- That constant nagging feeling about something uncomfortable you have to do today…
The environment may not help either:
- You work in an office with constant noise and many visual distractions.
- Your workplace is hostile, and for some reason you don’t feel comfortable there.
- Your desk is a complete mess, without you realizing that the clutter affects your ability to focus too.
So how can you stay focused on a task for a reasonable amount of time and finish it well and quickly?
Here are some tips I’ve been using for a long time:
- I identify the tasks I need to do each day. It may sound trivial, but knowing the ten things you need to handle over the next few hours makes your work feel more controlled and calm, which helps you concentrate.
- Get the tasks you like least out of the way first. There’s nothing worse than working while knowing you still have that uncomfortable phone call or incredibly boring report waiting for you.
- If you can work remotely, find a comfortable, inspiring place where you know you won’t be interrupted.
- Close anything that might bother you while you’re working: your email client, notifications, and so on; put your phone on silent.
- If necessary, use a signal to let your colleagues know you need an interruption-free hour.
- “Kidnap yourself”: tell your managers or colleagues that from ten to two today, you want to disappear from the world so you can focus as much as possible on some difficult, demanding tasks. It works wonderfully, even if it sounds eccentric.
- Avoid answering calls while you’re immersed in a task.
- Minimize the need to stay on the phone constantly. If people get used to calling you about everything, they’ll manage your time for you instead of you managing it—even though very few things are truly urgent. As strange as it may sound, you can also teach clients to contact you efficiently by email.
- If your boss isn’t receptive to this, buy them a copy of Deep Work or explain that you want to be more productive and improve the quality of your work.
- Try the Pomodoro technique to structure your tasks.
- Leave design and new-code development for the morning, and do testing, documentation, and improvements in the afternoon. After sleep, your brain has more energy for creative tasks—though the best approach is to know yourself and figure out when you work best on different kinds of tasks.
- Spend a few minutes at the end of the evening mentally reviewing, even briefly, what you need to do the next day. Somehow, you’ll need much less effort to organize your day when it arrives.
- Avoid time vampires like the plague.
- Track your productivity by noting the tasks you’ve completed. You’ll see that small changes like the ones above lead to better results.
And if you want to be even more of a geek, spend a few minutes meditating now and then…