“Flow is the source code of ultimate human performance” – Steven Kotler
This is a chapter draft of my upcoming book “From One to Zero” with publisher NoStarchPress about minimalism in programming. The book will appear in 2021—stay tuned on my email list with lots of free Python content:
In this chapter, you’ll learn about the concept of flow and how you can use it to ramp up your programming productivity.
What It Is
The concept of flow was popularized by Mihaly Csikszentmihalyi (pronounced “chick-sent-me-high”), a distinguished professor of psychology and management at Claremont Graduate University and former head of the department of psychology at the University of Chicago. In 1990, Csikszentmihalyi published the ground-breaking book about his life’s work under the same title, Flow.
But what is flow anyway? Let’s start with the intangible definition—or how it feels. Afterward, you’ll learn a more tangible definition of flow based on what you can measure—as a coder you’ll like the second definition more!
If you experience flow, you could describe it as a state where you’re completely involved in the task at hand, focused, and concentrated. You forget about time and are wholly involved in the task at hand. You feel like you are in the zone, fully immersed in the task before you, focused, and hyper-aware. It completely absorbs your attention. You feel a sense of ecstasy where you don’t feel the burden of everyday life. Your inner clarity increases, and it becomes evident to you what you need to be doing next—the activities flow naturally from one to another. You’re also confident that you can do the activity, resulting in greater exploration and even risk-taking. You forget time, forget inner struggles, worries, and fears, and grow beyond egoistic purposes. The activity is intrinsically rewarding—you enjoy the task while doing it. Both your performance and your results go through the roof.
Six Flow Components
According to psychological research lead by Mihaly Csikszentmihalyi, there are three six components of a state of flow.
- Attention: You feel completely focused. Your thoughts are centered around what happens at this particular moment, and you feel a deep sense of concentration.
- Action: You feel a bias towards action, and you move forward with your current task quickly and efficiently—your focused awareness helps drive the momentum. Every action feeds into the next action creating a flow of successfully finished actions towards completing the task.
- Self: As a result of the biological processes in your body, you become less aware of yourself, and you shut down your inner critics, doubts, and fears. You think less about yourself (reflection) and more about the task at hand (action). You lose yourself in the task at hand.
- Control: Still, even though you’re less self-aware, you enjoy an increased sense of control about the present situation. The sense of self-control gives you calm confidence, and you allow yourself to think outside the box and to develop more creative solutions.
- Time: It seems to stand still—you lose the ability to experience time passing, and your subjective experience of time changes.
- Reward: You are fully immersed in the activity before you, and you enjoy it. Just doing the activity is what you want to do—even though there may be no external reward. Being immersed in the activity is intrinsically rewarding.
All of those referenced components are subjective—and if you’re like me, you’ll want to know if it can be measured. Let’s see!
Biological Effects of Flow
The terms “flow” and “attention” are closely related. In a 2013 dissertation about ADHD, Rony Sklar describes attention as follows (highlights by me):
“The general consensus of researchers is that, rather than attention being a unified concept, it is “a multifaceted concept that implies multiple behavio[u]ral states and cortical processes that various subsets of cerebral structures control” (Zillmer et al., 2001, p. 170). This is supported by research findings from neuroimaging, neuropsychological, clinical and neuroanatomical studies, which reveal that attentional functions cannot be localised to one single area (Tucha et al., 2008).”
This highlights two critical observations. First, you cannot reduce attention to a single variable or location in the brain—it is a multifaceted concept. Second, there’s tangible research examining the various forms of attention—much of the work is focused on the “negative” impacts of patients with ADHD. However, Sklar points out that the term “attention deficit” wrongly implies that patients experiencing it cannot focus. But nothing could be further from the truth! In fact, another term for flow is hyperfocus, and researchers worldwide have shown that ADHD patients are quite capable of it!
In a 2000 publication, researchers Kaufmann, Kalbfleisch, and Castellanos argue that “ADHD is not characteri[s]ed by an inability to sustain attention, but rather by the inability to appropriately regulate the application of attention to tasks that are not intrinsically rewarding and/or that require effort.”
Whether you have ADHD or not, you know the feeling of forcing yourself to sustain a not intrinsically rewarding task. You don’t need to get diagnosed with ADHD to know that it’s hard to focus on things you don’t enjoy doing. As soon as you enjoy the task and you find it intrinsically rewarding, it’s easy to reach a state of hyperfocus or flow. If you’ve ever lost yourself playing an exciting game, programming a fun application, or sleeping with your partner—you know how easy it is to reach flow if you like the activity.
Your body releases five “feel-good” neurochemicals such as endorphins, dopamines, and serotonin in a state of flow. You forget about the scary things in the past or the future. You end up in the deep now. Your stress hormons flow out of the system. Your sense of self disappears. Your inner critic gets silent. This combination of changes in your consciousness is liberating—nobody is holding you back. That’s why these neurochemical pleasure drugs can become addictive. But this addition makes you smarter and more productive—if you manage to direct the flow activity into productive endeavors such as programming!
Here’s what an expert in flow research, Troy Erstling, writes about the biological effects of flow:
“So let’s review – A flow state is like taking cocaine, speed, heroin, marijuana, and anti-depressants all at the same time! […]
In more scientific terms, Norepinephrine hones focus (data acquisition); dopamine improves pattern recognition (data processing); anandamide accelerates lateral thinking (widens the database searched by the pattern recognition system), and endorphins help to modulate stress levels and keep you calm along the way. ALL of these also feel amazing on top of it.
Just to drive this point home – Flow is the only time the brain produces all 5 of these neurochemicals at the same time!”
Flow feels great and leads to great results at the same time. Now, you may ask: show me the meat—how do I get flow? Let’s answer this next!
How to Achieve Flow?
Csikszentmihályi laid out three conditions to achieve flow: (1) your goals must be clear, (2) the feedback mechanism in your environment must be immediate, and (3) there’s a balance between opportunity and capacity.
(1) Clear goals: If you’re writing code, you must have a clear goal towards which the smaller actions align. In a state of flow, every action naturally leads to the next, which leads to the next. But where does this end? A fundamental condition to obtain flow in the first place is to set a clear end goal that you want to accomplish and towards you can target your small actions. Playing computer games is a frequent environment for reaching a state of flow because if you succeed in the small actions—such as jumping over a moving obstacle—you ultimately succeed in the big goal—such as winning the level. If you want to use flow to accelerate your programming productivity, you must have a clear project goal in mind towards which you work regularly. Every line of code leads you closer to the successful completion of the larger code project. Why not track the lines of code you’ve written to gamify your coding work!
(2) Feedback mechanism: Machine learning engineers know that they need to have a great feedback mechanism to train highly effective models. Most supervised machine learning algorithms, such as reinforcement learning, heavily rely on reinforcing desired behavior and punishing undesired behavior. For example, you may give a robot learning to walk an artificial reward for each second it doesn’t fall and tell it to optimize for a maximum total reward. The robot can then automatically adjust its action to obtain maximum rewards over time. We, humans, behave quite similarly when learning new things. We seek appreciation from our parents, teachers, friends, or mentors—even from the neighbors we don’t like—and adjust our actions to maximize appreciation while minimizing (social) punishments. This way, we learn to take specific actions and avoid others. Receiving feedback is vital for this way of learning. How could you possibly know whether an action is positive or negative if you didn’t receive any feedback from the real world?
Feedback is a precondition for flow. If you want to implement more flow in your working day, seek more feedback. Find project partners that you meet weekly. Publish your code on Reddit or StackOverflow and ask for feedback. Publish your MVP early and often to receive a never-ending stream of user feedback for the features your software provides. Seeking feedback for your programming efforts works like a charm. After my software application to learn Python, Finxter, started to receive a never-ending stream of user feedback, I was hooked. The feedback kept me going to work more and more on the code, and it opened the door for many states of flow working on the code to improve the app.
(3) Balance opportunity and capacity: Flow is an active state of mind that pulls you out into new territories. You feel a rush of excitement that you can only experience by exploring new and fresh opportunities. If the task is too easy, you get bored easily, and you lose the rush of excitement quickly. If it is too hard, you’ll throw in the towel early. The task must be challenging but not overwhelming.
Figure 7-1 shows the landscape of possible states of mind—I redraw this visualization based on the diagram proposed in Csikszentmihályi’s original research.
Figure 7-1: In a state of flow, the challenge is neither too hard nor too easy, given your current skill level.
The x-axis quantifies your level of skills from low to high, and the y-axis quantifies the difficulty of a given task from low to high.
- If a task is way too hard for your current level of skills, you’ll feel panic.
- If a task is a bit too hard for your current level of skills, you’ll feel anxiety.
- If a task is a bit too easy for your current level of skills, you’ll start feeling bored.
- If a task is way too easy for your current level of skills, your boredom will quickly morph into apathy.
- But if a task’s difficulty matches your current skills, you’ll maximize the likelihood of the appearance of flow.
Note that what may be too hard for you is probably very easy for a more skilled person. The trick is to constantly seek harder challenges and increase your level of skills accordingly by learning and overcoming the obstacles posed by the real world. This learning loop keeps you in a vicious cycle towards higher and higher productivity and skill, and greater enjoyment of work at the same time.
Top 6 Flow Tips for Coders
In the previous section, you’ve learned the most important preconditions that must be given to enable flow in your professional life. But what are some quick tips and tactics that follow from them? Next, I’ve compiled a list for you that’s highly biased towards the coding niche.
#1 Always work on an explicit practical code project.
In fact, in my Finxter online material, I recommend splitting your learning time into 70% of working on a practical fun project of your choice and only 30% of reading books and tutorials or watching educational courses. Most coders have this backward. They are stuck in the learning loop—they never feel quite ready to leap into a real project. So, they keep learning and learning, making them even more aware of their knowledge’s limitations—a negative spiral towards paralysis. But there’s a way out: set your clear project goal and push the project through to completion, no matter what. As it turns out, setting clear goals is also one of the three preconditions of flow. It’s a simple strategy, but it works wonders for the coding students that implement it!
#2 Work on fun projects that fulfill your purpose.
Flow is a state of excitement. To obtain flow, you must be excited about the project you’re currently working on. If you’re a professional coder, spend lots of time thinking about the purpose of your work. Convince yourself of the value of your project. If you’re only learning to code, lucky you—you can choose a fun project that excites you! Work on projects you love and that are meaningful for you. You’ll have more fun, a higher probability of success, more resilience against temporary setbacks, and passion-infected users. If you cannot wait to work on your project when opening your eyes in the morning, you know that flow is just around the corner.
#3 Perform from your strengths.
This tip from management consultant Peter Drucker is gold. You’ll always have many more weaknesses than strengths. Thus, your skills are below average for most activities. If you focus on your weaknesses, you’re virtually guaranteeing yourself to fail professionally, speaking in relative terms. The most successful people focus on their strengths, building large skill islands around their strengths, and essentially ignoring their weaknesses. Then they spend most of their time doing challenging work in areas they’re highly skilled in (see the flow channel in Figure 7-1). What are you uniquely good at? What are your specific interests in the broad area of computer science? Make lists to answer those questions and spend lots and lots of time gaining clarity—I cannot think of an activity that is as highly leveraged as figuring out your strengths and then following up with brutally structuring your day around those.
#4 Block large chunks of coding time.
Every coder knows that it takes some time until a complicated code project is “loaded” into their head. Say Alice and Bob work on a given code project. Both must spend 20 minutes to attain a state where they completely understand the demands of their code project—glancing over the project, diving into a few code functions, and thinking about the big picture. Alice spends three hours every three days on the project, while Bob spends one hour every day. Who will make more progress in the project? Alice works (3h – 20min)/3=53 minutes on the project per day. Given the high constant loading time, Bob works only 40 minutes on the project every day. Thus, all other things being equal, Alice will outwork Bob by 13 minutes every day. She has a much higher chance of achieving a state of flow as she can dive deeper into the problem and lose herself entirely in it.
#5 No distractions during your flow time.
Wow—how obvious, but how seldomly implemented! Coders who can reduce distractions—social networks, entertainment applications, chitchat about colleagues—attain flow much more often than coders who can’t. Given that working in a state of flow accomplishes up to 5x the results than working in a more shallow state of mind, you can now begin to see why some coders reach orders of magnitude the results than others. To reach success, you must do what others won’t—shutting down distractions is one of those things few people are willing to do. This is why switching off your smartphone and close that social media tab provides such a huge leverage point for your success as a coder.
#6 Do the obvious things you know you need to do.
Just in case you wonder what they are: plenty of sleep, healthy food, consumption of high-quality data, and regular exercises. As a coder, you know the expression garbage-in, garbage-out: If you feed a system with bad inputs, you’ll obtain bad results. Try to cook a tasty meal with decayed food—almost impossible! A great cook will focus on improving the quality of the ingredients because they know that high-quality input leads to high-quality output.
Similarly, as a coder, you’re a system that transforms inputs—sleep, food, information, sun—into code. The better your inputs, the better your output. Read programming books instead of shallow blog articles—or better yet, read research papers published in top-rated journals, the highest quality of information there is. Sleep 8 hours to increase your level of focus and attention during the day. Eat healthily and allow your body to reach peak performance. All those ingredients will increase the likelihood of accomplishing flow!
So, how can you pick the low-hanging fruits of flow research? Block time, focus on one task, stay healthy and sleep properly, set clear goals, find work you enjoy doing, and actively seek flow. In his 2013 research, Schaffer seven flow conditions, you can ponder upon to increase your flow per unit of time ratio: (1) Know what to do, (2) Know how to do it, (3) Know how well you’re doing, (4) Know where to go, (5) Seek challenges, (6) Work on your skills to overcome the high challenges, and (7) free yourself from distractions.
If you seek flow, you’ll find it. And if you systematically work in a state of flow daily, you’ll boost your work productivity by an order of magnitude. A simple yet powerful concept for programmers and other knowledge workers alike.
“The best moments in our lives are not the passive, receptive, relaxing times… The best moments usually occur if a person’s body or mind is stretched to its limits in a voluntary effort to accomplish something difficult and worthwhile.”Mihaly Csikszentmihalyi
In the next chapter, you’ll dive into the Unix philosophy about doing one thing well, a principle that’s proven to be not only an excellent way to create a scalable operating system but to be a great way to live by as well!
- Massimini, F., Csikszentmihályi, M., & Carli, M. (1987). The monitoring of optimal experience: A tool for psychiatric rehabilitation. Journal of Nervous and Mental Disease
- Hyperfocus in adult ADHD: An EEG study of the differences in cortical activity in resting and arousal states, Rony Sklar, 2013, Dissertation
- MONTESSORI EDUCATIONAND OPTIMAL EXPERIENCE:A FRAMEWORKFOR NEW RESEARCH
- How to Get Into The Flow State | Steven Kotler: https://youtu.be/XG_hNZ5T4nY
- URL: https://en.wikipedia.org/wiki/Flow_(psychology)
- URL: https://en.wikipedia.org/wiki/Mihaly_Csikszentmihalyi
- URL: https://greatperformersacademy.com/books/8-amazing-tips-from-flow-the-psychology-of-optimal-experience
- URL: https://troyerstling.com/the-neurochemistry-of-flow-states/
- URL: https://www.karmacrm.com/blog/three-conditions-required-for-the-mental-state-of-flow/
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.