Getting into the Developer Flow State

What is the most annoying thing at work? If you ask developers, it is getting interrupted in the middle of a difficult programming task. That reminds me of the classic cartoon strip I saw making the rounds on HackerNews a few years back:

This is the perfect illustration of “flow state”. Your mind is clear and you feel you are in a natural rhythm where your knowledge, motivation, and concentration magically align. It is the heart of optimum performance and creativity often referred as “being in the zone”.

Flow state is particularly important when programming as there are so many variables you are juggling (pun intended). It is also a precarious state as even the slightest distraction can wreck your productivity. Unfortunately we live in a world optimized for distractions.

The workplace is often the destroyer of getting work done. From an article in the Harvard Business Review, the numbers on workplace interruptions are depressing:

One workplace study found an average of almost 87 interruptions per day (an average of 22 external interruptions and 65 triggered by the person himself). Then, on average, it takes over 23 minutes to get back on task after an interruption, but 18% percent of the time the interrupted task isn’t revisited that day.

The first thing to recognize is that sometimes the enemy of flow is ourselves. The founder of Stack Overflow, Joel Spolsky, shared candidly that he can be massively unproductive. Our mental inertia makes it hard for us to simply get started.

Second, sometimes what looks to the outside to be unproductive can actually be someone working in the flow. The creative work of coding does not look “busy”:

Developers can appear very unproductive at times, sitting staring at the screen with our headphones on and very little in the way of keyboard clackety-tap. This however is when we are doing our thinking, when we are building up, adding to and rearranging the mental model of how our code will work.

Lastly, sometimes our work environment conspires against us. Besides the distractions of chat, desktop and mobile notification, and open office spaces, the tools we have for the job can limit our ability to get things done. One of our developers at Stack experienced this recently and his breakthrough led him to this conclusion:

Your developer happiness is unquestionably directly proportional to the ease of the tools you have to accomplish your task.

I think what we have built with Stack is one of those tools. With our Enterprise (and soon Channels) offerings, we give developers a tool to help maintain flow and avoid interruptions (or interrupting fellow devs). Having a repository of internal knowledge can help jumpstart one’s flow towards solving a difficult problem or help maintain an existing flow.

What are your thoughts on achieving flow state and what have you found to help you stay focused on programming tasks?

Stack Overflow Question of the Week

How to explain to a layperson why a developer should not be interrupted while neck-deep in coding?

I work on the Stack Overflow Enterprise team and help companies solve the challenges of easily sharing tech knowledge internally through a private version of our Q&A technology and our community building implementation expertise.