Psychologists call it Flow. Developers might refer to it as being in the zone, or wired in.

Don't disrupt him Dave, he's in the zone!

It's an interesting subject, especially looking at it from the angle of a programmer.

So what is flow?

Flow is a mental state. When a person is performing an activity which requires a certain amount of skill and concentration the person is fully immersed and focused on the task at hand.

Flow is a strange beast. As developers, it's a state we try to reach and stay in for as long as possible. For various reasons:

  • We feel much more productive.
  • Our skill grows much more rapidly when we are fully focused.
  • We build up a mental model of the code we are working with, because of this we can become much more creative in the way we solve a problem.
  • We tend to make less mistakes.

It's common to stay up at silly hours in the morning, as some of us find it much easier to get into this state late at night.

This emotional state isn't exclusive to programming. It's common in many activities, music and gaming are two such activities which possess the properties needed to achieve flow. Actually, flow is one of the main reasons people play video games!
One of the primary goals of any game should be to heighten intrinsic motivation (behaviour that is driven by internal rewards) which is linked to flow.

The mechanics of flow

The body is a machine after all, and (according to study) the mind can attend to only a certain amount of information at a time; approximately 126 bits of information per second. This is a lot! Though having a conversation takes about 40 bits, which is why it becomes increasingly difficult to focus on other things whilst having a conversation.

For the most part, people are able to decide what they want to focus their limited attention on. With flow, the person is completely engrossed in the task at hand that he/she loses awareness of other things; including time, distractions, even the more basic feelings like hunger; even pain.

Why do we seek flow?

It's the ultimate experience in harnessing our emotions for the service of performing and learning.
More than that however - It's addictive.

The reason we like flow is because when emerging from it, we feel our skill has grown, or better yet - been proven. Kinda like a personal ego boost. That's flows addictive nature.

How to get in the zone.

Getting into the flow state can differ greatly depending on the task. I'm pretty sure it takes longer for programmers to achieve this state than it does a gamer for example. Largely because of the amount of information you have to load into your mind before you are up to speed; therefore can progress.

Obviously, there are many emotional states in which the mind can attain. If a person was to actively attempt to reach any one of these states, some are more difficult to achieve than others.

Flow is one of the more difficult states to achieve, due to it requiring such a number of variables to be true.

  1. No interruptions.
  2. A positive outlook towards the task at hand.
  3. A minimum skill level.
  4. Belief in your own ability.
  5. An activity with a clear set of goals.

No interruptions

It's fairly obvious why interruptions are bad when trying to get into the flow, but this popular graphic says it all really:

Don't interrupt a dev

A positive outlook towards the task at hand

If you don't believe what you're doing, or think it's worth your time; you have a negative outlook - it's much more difficult to focus whole heartedly on a task you feel negatively about.

A minimum skill level

If you find you are still making conscious decisions about the basics, you aren't going to get into the flow state.

Take driving as an example. At first you have to pay attention to all the details because it's new - changing gear, braking, indication, looking in your mirrors etc... All of this is at the front of your mind, so much in fact; that it's difficult to focus on where you're actually headed. However when you get more proficient at driving, you stop thinking about the basics, and instead your mind is free to focus on the more important aspects such as direction and danger awareness.

The same is true for programming, gaming; music etc... This basic function is needed before flow can be achieved.

Belief in your own ability

Usually, attempts to solve a problem without belief in yourself will fail. Belief that you can do it is a powerful thing. Positivity is necessary to achieve a flow state.

An activity with a clear set of goals

In your mind, you need a picture of what the end game is. If you aren't clear of what you're trying to achieve, you may get confused along the way which will break your concentration/focus.


Getting back into flow sooner

There are tools and techniques which can help you get back into flow if you are interrupted.

  • Try leaving a 'you were doing...' note.
  • foc.us - is a headset which is supposed to stimulate you brain, helping you to focus much easier and much longer.

TDD can also help to get back into flow. Given that each test acts as a kind of note, telling you where you left off. Also with the nature of TDD, it doesn't require you hold large infrastructure models in your mind before you proceed - they much smaller; isolated pieces of work.

The myths

In music, there are people who claim to have experienced flow to such a level; that they feel as though nothing else exists the music. All sense of time and self awareness disappeared... Sounds peaceful.