Hacking the Flow State

Photo Credit: https://www.flickr.com/photos/55934520@N00/4560121213

Post originally published on Medium.

Flow is described as: “the mental state of operation in which a person performing an activity is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity.” Anyone who has programmed for long enough will recognize this state as incredibly productive and satisfying.

Often, when I’m able to slip into a state of flow while coding, I will produce more in a single afternoon than I could in several days of non-flow. Yet this is often an elusive state to obtain. Luckily, research dedicated to this topic in recent decades offers some help. Here we’ll look into both the stages of flow and how to obtain the prerequisites for flow, making it possible in the first place.

The Setup

One of the foremost flow researchers, Mihaly Csikszentmihalyi, identified the necessary requirements which allow for flow states to occur:

  • Clear goals
  • Clear and immediate feedback
  • Good balance between one’s perceived skills and those perceived as necessary for the task
  • Uninterrupted concentration time

While coding, these flow requirements often take the form of a clearly defined problem to be solved and some sense of how to get there. Keep in mind, if you are lacking this clarity, it is unlikely that you’ll be able to enter flow. As such, it makes sense to spend time on the upfront work of establishing these criteria. Ask yourself:

  • What does success look like?
  • Do I have a way to quickly test if I’m making progress? Can I create milestones along the way?
  • Can I break the problem down into smaller chunks?
  • Do I feel comfortable with the level of skill required? If not, what resources are available to help me develop that skill — coworkers, Google, Stackoverflow?
  • Have you created uninterrupted space and time?

Hacking the Setup

What can you do if you’re missing a clear goal, feedback loops, or challenge in the task at hand? To give the simple answer: create these things.

Clear Goals and Feedback Loops

One simple hack for both feedback and clear goals can be test-driven development (TDD). Writing tests for TDD forces consideration of a desired future state of the program and creates clear milestones for completion. These tests can be run and give quick results and create a feedback loop cycle which satisfies the need for near-realtime feedback.


Unfortunately, coding hasn’t become as fun as it is in the movies yet. Many parts of the daily programming tasks can feel rote at times. While there are many ways to address this, such as code generation or DRY codebases, I’ll assume you’re already using best practices and present another option: micro-challenging yourself.

Say, for example, that you are creating email templates — something which has been a rough task everywhere I’ve worked. Why not try to make it a game for yourself, maybe see how quickly you can get it complete? Or see how close you can get on the first try, or perhaps try to improve the templating system as you go (as our Web Lead, Joe Lencioni says it, find a way to “leave it better” than you found it). Obviously, these particular strategies won’t work in every case, so be creative in challenging yourself.

The Cycle

In his book, The Rise of Superman, Steven Kotler examines the lives of extreme athletes and their pursuit of flow while drawing parallels to those of us with more mundane lives. Kotler enumerates 4 stages of flow, which help elucidate ways to better set up flow states in day-to-day coding: Struggle, Release, Flow, and Recovery.


Struggle is just that — the overwhelming part of the cycle, where the challenge is difficult and your brain is working hard to form new connections and make associations with an overload of information. It’s likely you aren’t making much progress at this point, and it’s frustrating. You may be diagramming possible solutions, reading through related parts of the code base, or talking with a co-worker to understand what it is you’re trying to implement. Struggle isn’t fun, but it’s a critical part of the flow cycle — giving your brain the information it needs to begin developing a solution.


During Release, you take your conscious mind off the problem. The could be activities like: going for a walk, playing ping pong, sitting in the park, meditating, or yoga. During this phase, your brain is organizing the problem subconsciously and forming connections between the pieces loaded during Struggle.

This is a necessary part of tackling any larger problem. Our working memory can hold a very limited set of objects in it at any given time, so solving complex coding problems isn’t possible without the aid of our higher-capacity non-conscious brain.

One interesting note: because of the way which they stimulate your brain, watching TV will not aid in this subconscious processing. It will actually block your ability to transition into the next stage in the cycle. (I suspect video games fall into this category as well, but Kotler doesn’t mention them specifically.)


In this stage, you feel in the zone. Flow allows you to focus on the task at hand without distraction, often slipping into a state where time seems to pass differently and problem solving just happens. You are fully immersed in the task at hand.


Finally, once the Flow stage is complete, your brain and body need recovery. I believe this is the most frequently skipped portion of the flow state, making it difficult to restart the cycle. Because each of the prior stages requires the release of neurochemicals and a great deal of energy consumption, the body and mind need time to reset before you can enter into flow again effectively. Similar to neglecting rest and recovery after a hard workout, attempting to skip this final stage in the flow cycle will mean you get stuck in Struggle — leaving you unable to reap the benefits and move back into Flow.

Hopefully this sparks your drive to try out some flow-hacking for yourself. If you find yourself stuck struggling for long periods of time, remember to be deliberate in Release and Recovery. Check your sleep, diet, and other mental and physical hygiene factors, and good luck out there.

Leave a Reply