The idea of flow state has been popularized by Mihály Csíkszentmihály. In his research, he describes flow as a mental state in which a person performing an activity is fully immersed, focused, and enjoying the task at hand. It's that weightless feeling of humming along with perfect productivity. That state where just doing the work is in itself intrinsically motivating, without the need for rewards or consequences as motivators. It's that sensation of being “in the zone.”
As a developer, you’ve likely experienced this zen-like state while writing code or solving challenging problems. I was in the zone while solving the programming puzzles for last year's Advent of Code, a coding challenge that released a new puzzle every day in December. Unfortunately, as our careers progress, we can find ourselves working on mundane tasks, solving the same problems over and over again. As we'll learn, routines can be the enemy of the flow state.
When our work becomes routine, it may feel like obtaining flow is impossible. Difficulties in achieving and staying in flow state include feelings of apathy, boredom, and anxiety that can crop up if our skills don’t align with the challenge of our work. There's a helpful diagram that explains how our work can make us feel:
When challenges are low, and one's skill level is also low, this can cause apathy - a lack of interest in the task at hand. If the challenges are low, but our skill level is high, we may quickly become bored. When challenges are higher than one's perceived level of skill and ability, this can cause a heightened sense of anxiety.
According to Wikipedia, "These states, in general, differ from being in a state of flow, in that flow occurs when challenges match one's skill level. Consequently, Csíkszentmihályi has said, "If challenges are too low, one gets back to flow by increasing them. If challenges are too great, one can return to the flow state by learning new skills.”
Flow is achieved at the intersection of challenging work and a high skill set. We need to be doing challenging work, while feeling like we have the skills to achieve it. Unfortunately, the chances are that conditions just aren't ideal for flow most of the time. Luckily, while we can't force a state of flow, we can make changes to how we work to increase the likelihood of feeling in the zone.
To help us understand how, here are the seven conditions for flow as proposed by Owen Schaffer in a 2013 whitepaper:
- Knowing what to do
- Knowing how to do it
- Knowing how well you are doing
- Knowing where to go (if navigation is involved)
- High perceived challenges
- High perceived skills
- Freedom from distractions
So how can we try to nudge our work in a direction that will allow us to achieve flow? Let's break each of these down:
(1) Knowing what to do
Knowing what to do may seem obvious, but we've all sat down for work sessions without having a clear idea of what we need to do. We think we can just wing it, but your goals need to be clear and achievable to maximize the chance of achieving flow. To do this, identify what success looks like for your working session before you start. Have a specific idea of what you need to accomplish.
(2) Knowing how to do it
If you don't have enough knowledge to complete the task at hand, you may start slipping into a state of worry or anxiety. If you don't feel like you know enough to do the task at hand, pause and regroup. To increase your skill level, you can read and research until you have learned enough to take another crack at solving the problem. Success in achieving flow involves making the problem achievable.
(3) Knowing how well you're doing
Feedback about how well you're doing needs to be clear and immediate. Luckily for us developers, in writing software, it's easy to set up your environment to quickly signal success or failure. For example, as a front-end developer, you can aim to have a working prototype as quickly as possible. Set up an auto-refresh on your work-in-progress to see your project move along in real-time.
Another strategy for immediate feedback is practicing Test Driven Development. Even if you don't adhere to every aspect of TDD, write a few unit tests, and run them frequently. If your test suite is fast, you can even have your tests run every time you save a file. You'll be able to tell right away if your code is working or not.
Whatever approach you take, work in small increments and test your work frequently.
(4) Knowing where to go
Knowing where to go helps you achieve flow when navigation is involved (when playing sports, for example), but I think it's also vital for programming tasks. Pausing frequently to figure out what to do next can be very distracting. Help yourself know where to go by breaking up tasks into small, clear, concrete actions and create a detailed to-do list.
(5) High perceived challenges
The work that you're doing needs to be sufficiently challenging to achieve flow. If your skills are high, but the task isn't challenging, you're likely to slip into boredom or even apathy. It can be difficult to raise the perceived challenges for mundane work, but if you can make your work more challenging, you'll be more likely to slip into that elusive flow state.
Don't aim to overcomplicate things, but ask yourself if you can teach yourself something new while working on this task. Is it possible to apply a new paradigm or design pattern to this problem? Can you use a new programming language feature or even learn a new programming language to achieve your goals or write your code more elegantly?
(6) High perceived skills
You need to believe that your skills are adequate to do the task at hand. We've already learned that if your skill level is too high for the task, you may feel bored. If your skill level is too low, you may become anxious. Your actual skills may be more than enough to get the job done, but if you don't believe in yourself, you'll never attain that state of flow.
As programmers, we tend to suffer from imposter syndrome. There will always be someone smarter, better, and more eloquent than you. That doesn't mean that you aren't fully capable of doing the job. If your skills are high, but you still don't feel up to the task at hand, check out these resources for beating imposter syndrome. To achieve a flow state, you need to have the skills and you need to feel like you have the potential to succeed.
(7) Freedom from distractions
In today's world full of notifications vying for your attention, freedom from distractions may feel like an impossible goal. Thankfully, there are tools to help. First and foremost, I recommend turning off your phone and keeping it in another room if you're looking to achieve a productive work session.
There are free browser plugins that block distracting websites, such as StayFocused for Chrome and Leechhblock for Firefox. There's a mobile app for iOS and Android called Forest that helps you train your attention. If all else fails, you can even block distracting websites on Mac with the SelfControl App.
While there's no surefire way to force flow, the tips above may help you achieve that ever-elusive state. Research has shown that there can be tremendous benefits to working in flow! Working in the zone can increase your sense of achievement and overall satisfaction. It can make the mundane seem more fun, and get you more excited about solving challenges.
Lastly, if you'd like to know more about the topic, make sure to watch the seminal TED talk by Mihály Csíkszentmihályi: Flow, the Secret to Happiness