Why Attention Matters
“Your focus determines your reality.” —Qui-Gon Jinn, Star Wars: Episode I: The Phantom Menace
Attention is important for doing things, but it is a limited resource. For developers, attention is crucial for prioritizing different tasks, problem-solving, and working effectively with others. We can focus on hard things, such as playing piano or chess, for up to about four hours in a day according to this influential study by Swedish psychologist K. Anders Ericsson. These four hours aren’t all at once, however, and it can take years of practice. Four hours of deep work can be particularly challenging for developers. Microsoft Research found that information workers including administrative support, engineering, and management can focus for just 40 seconds on average before being distracted.
Not only is attention finite, but it also has an important dependency that is worth mentioning: working memory. Analogous to a call stack overflowing its allocated memory with a
Maximum call stack size exceeded error, you can cognitively overload your working memory. Your working memory constrains your attention and what you can actively process as a developer. This is what happens when you find yourself yak shaving or after finally resolving a sub-problem of a sub-problem of a problem and you need a few seconds to recall what you were working on before you took the detour. We can hold an average of four chunks of information in working memory in order to focus on them. Test yourself in this short memory game.
Despite limitations, we have the ability to significantly increase our capacity to focus and improve the quality and quantity of our attention, empowering us to be more effective as developers. This article shares five strategies.
How to Manage Your Attention
Sleep Eight Hours
Sleep has the most significant effect on the quality of your attention. Therefore, it is useful to know when you are most alert in order to make the most effective use of your attention. You can do this by understanding your chronotype. Are you an early bird or night owl? If you aren’t sure, you can use this morningness-eveningness questionnaire to find out. Once you have determined this, adjust your sleep schedule to align with your circadian rhythm as closely as possible to get the recommended eight hours of sleep. This is often easier said than done, one strategy to do this is to set an alarm for when to go to sleep, not when to wake up according to Matthew Walker’s Why We Sleep: The New Science of Sleep and Dreams.
Control Your Environment
You shape your environment and your environment shapes you. Whether at home or at work, external environmental cues affect your behavior and what you pay attention to as a developer. Examples of environmental factors include room lighting, music, conversations, phones, and computers.
The first thing you can do to begin to control your environment is to understand how you work best. This can be as easy as experimenting and reflecting on where and when you are most productive. You can even use tools like the Big Five to help understand yourself better. Another useful heuristic is to ask yourself whether you are a dandelion or an orchid. Are you able to be productive in almost any environment or do you only truly thrive in specific surroundings? One of the key ideas in Susan Cain’s 2012 book Quiet, is to understand “introversion and extroversion as preferences for certain levels of stimulation.” With this knowledge, you can adjust your current environment or create an optimal work environment. More technology companies, including Sparkbox, allow employees to work remotely, which is another way that you can have more control over your environment. When you are at work you can use a variety of ways to let coworkers know when you’re in focus mode. In Deep Work, Patrick Simpson shares some simple, but effective things you can do to control your environment:
You should inform your co-workers when you’re working deeply and that you’d simply prefer to not be distracted unless for true emergencies. You can use a sign or a signal to indicate when you’re focusing. If you work in an open office space, like me, invest in a good pair of headphones, and listen to relaxing music or white noise (for me beach sounds, rain, thunder, or 10 hours of Star Trek engine noise).
Write Down Your Intention
This is a simple, but important way to improve your ability to focus as a developer. Research on goal-setting shows the importance of setting implementation intentions. Make your intention explicit by specifically describing not just what, but when, where, and how you intend to accomplish a task. “Work on the ‘delete a review’ feature tomorrow morning” becomes “From 9 am to 12 pm tomorrow, create a new link in the review template. The link should go to the new route
DELETE /reviews/:id. Start with the mobile design that looks like X and following X accessibility guidelines.” Other specific steps may include writing tests for the new route, deleting a review, and redirecting to the reviews page, as well as displaying a confirmation message and writing the code to make the tests pass. Agile frameworks, like Scrum, do a great job of modeling this with concepts like user stories, pointing systems, acceptance criteria, and definition of done.
Set a Timer
Setting a timer works. Use your calendar, phone, watch, or even an egg timer. You can also use the time-tracking software at your workplace (we use Harvest at Sparkbox) or choose from one of the dozens of apps that use the Pomodoro Technique. Make sure to consider how long you plan to focus your attention on a task before you start to ensure that the task is small enough and defined well enough to complete. If you’re part of an agile team that sizes user stories with estimation points, you can use those estimates to help determine the right amount of time to accomplish the goal. This strategy also makes it harder for your work to expand to fill the time before a deadline, according to Parkinson’s law.
It’s easy to work open-ended, but this tends to lead to ineffective use of attention. Ask yourself how long you feel like you can or should focus on a task. If an hour seems insurmountable at 3 pm, try 25, 15, or even five minutes instead. Last, but not least, be sure to take a break when at the end of a time block. A good rule of thumb is to take longer breaks after 90 minutes of work. This corresponds to our natural brain cycles.
Plan for Distractions
As a developer, you will face both internal and external distractions at work. Your own thoughts are likely to distract you more than anything external. The most effective way to overcome internal distractions is to cultivate your awareness of them. Contemplative practices like meditation and mindfulness have been shown to be the most effective way to do that but are more or a longer-term strategy. Something you can do immediately to make it easier to bring your attention back from “that thing that you remembered you want to do that will only take a minute” is to simply write down anything that is on your mind before you begin a focus task. Get it out of your head. Kent Beck uses this technique in his classic book Test-Driven Development by Example where he uses a mini checklist to keep track of the unit he is currently testing adding additional tests, refactorings, and functionality to the list as they come up to be prioritized after completing the current objective.
Dealing with external distractions is more individualized and overlaps with controlling your environment. The important thing is to find strategies that work best for you. Example strategies include limiting information exposure by eliminating information sources and choosing when to expose yourself to them. Signal-to-noise ratio is a great metaphor for thinking about the difference between fundamentally valuable information and information that is merely feeding your bias for novelty and fear of missing out.
The Bigger Picture
As developers, we don’t always have the best defaults for how we manage attention. We may not be aware of how our attention affects our work or that the less we know about something, the less likely we are to realize it. There is a lot we can do to improve how we manage our attention. The strategies in this article are a starting point if you haven’t thought about how attention affects your work as a developer. The biggest takeaway is to start thinking about the strategies that will be most effective for you and how you work as a developer.