DEV Community

loading...
Cover image for Flow State: 10 Practical Tips for Getting In The Zone

Flow State: 10 Practical Tips for Getting In The Zone

justinschroeder profile image Justin Schroeder Updated on ・7 min read

I have this recurring dream where I sit down at a piano and start playing like a virtuoso. The music flows out of my fingers at the same speed as my mind is composing the music. In my mind my dream feels like the purest act of creation. It is beautiful, but it's only a dream. On this side of consciousness I can't even play an instrument. Yet, that feeling of "pure creation" where my imagination smoothly becomes a reality is incredibly familiar. In fact, as engineers, on our best days, it's what we do for a living.

If you've been a serious programmer for more than a few years, I imagine you've experienced this magic. There are a lot of names for it, flow state, deep work, in the zone, being under. However, I prefer “flow state” because it best describes the feeling I have when I'm there. The truth is, it can be as elusive and delicate as it is powerful, but the payoff is enormous — well worth the pursuit.

When you're truly in flow state, your productivity skyrockets. Complex problems break down to simple steps, intricate logic becomes obvious, and innovative design patterns emerge. Maybe I’m being a bit too romantic. I mean we're just writing some code right? Nah, when I'm truly in flow state I'm creating.

I've been programming for 21 years and, for the last five I've been cataloging my experiments regarding flow. The following recommendations come out of those five years, but these are not "scientific" in an academic sense. Just practical advice born of my own monastic pursuit of flow state.

Know the basics

In the beginning, there are some fundamental prerequisites. These are not meant to be exclusionary, as anyone can achieve these skills and conditions. However, if you feel you fall short on any of them consider this as a friendly encouragement to keep on pushing:

  1. Know the Syntax
    The kind of flow state we're after requires that concepts transfer smoothly into bytes. You cannot play the piano like a virtuoso if you're stabbing around for middle-c. I'm not saying you have the entire language perfectly memorized, but at a minimum the syntax needs to melt away.

  2. Know your Environment
    You need to have a familiar and stable development environment: operating system, editor, terminal, server stack etc. Be very cautious about messing with these precious tools. Don't install a new shell environment, use one editor, and don’t be the first person to upgrade your OS. Keep your work space stable and familiar at all times. If you want to experiment, use a different machine or try setting up a secondary account on your computer.

  3. Know your key commands
    Goes without saying right? But seriously, you should be able to go for significant stretches of time in a code editor without ever lifting your hands off the keyboard.

  4. Know How to "long-cycle"
    When writing code, in any language or platform — there is a "cycle":

    • You write some code.
    • You check to see if it did what you wanted.
    • You move on or adjust the code and repeat.

    Beginners typically write very small chunks of code, a couple lines for example, and then check the results. This cycling is necessary to reduce mental overhead (you can't hold all the code for an app in your mind at once), but in my experience, very small cycles also reduce the likelihood you'll reach “flow state.” It's a mental crutch that prevents your mind from learning how to balance more complex problems. Each cycle takes an amount of time to complete, even one or two seconds per cycle can really add up. This slows your progress and introduces opportunities for distraction. If you're a victim of “short cycling”, try to intentionally practice writing more code each time before you validate the results.

  5. Know how it works. It's important to understand the basics of the technologies you're working with. For example, if you're a web developer, you should really understand how the request/response cycle works, what HTTP methods are, how to interact with the Document Object Model (DOM), what event bubbling is etc. Sure you may use libraries that abstract these concepts away from you, but you must have an understanding of the underlying technologies. If not, it will be difficult to create a mental sandbox. A place where your mind can quickly and efficiently conceive new solutions to challenging problems.

If you're struggling with any of these basics it doesn't mean you can't be productive or produce excellent code. It just means the magic is harder to grab a hold of. The good news is practice makes perfect. Keep at it!

10 Practical Tips

Your brain hates getting into a flow state. What it wants are quick little dopamine hits that are addictive and supremely detrimental to productivity (lookin' at you Twitter). Flow is a marathon that your brain is reluctant to run. So what follows is a list of tips, tricks, and hacks that I've found help drag my mind, kicking and screaming, to the start line. These may seem trivial...because they are. Yet these sorts of small habits and patterns are tremendously useful in combating hours of half-focused waste.

  1. Know what you're going to work on. This one is important. Before you even sit down you should already know what your first keystrokes are going to be. To help, each time you stop working, write a short todo list on a scrap of paper or a notes app (not your team's Trello or Jira board) of what you need to work on next time you sit down. It's good for these to crescendo from small to large: 1. "Finish the primary navigation breakpoints" 2. "Write a click-away handler for the dropdown" 3. "make a new modal component". It can even be a good idea to even leave yourself a breadcrumb, such as an easy to solve problem that only takes a few lines of code to complete that’s been obviously left incomplete for you (by you). This little trick can really jump start your day's work.

  2. Close your apps. Shut down email, Slack, discord, social media and anything else that can send you a notification. Seriously. Shut 👏 Them 👏 Down 👏. Nervous someone will need you? Tell your co-workers to call you on the phone if it's really an emergency — trust me they won't call. People hate making phone calls. Those little red bubbles and pinging sounds are the death of flow state.

  3. Music. This is controversial, but I've always had my best sessions with music. I've found it's best to put something on that is well-worn. You already know the words and can get into the rhythm instantly.

  4. Ride the wave. Once you get into flow, ride the wave as far as it takes you, and then get off when it's over. Typically, I've found ~3-4 hours is as long as I can go before my mental state begins to crumble, but while I'm in flow I try hard to stay there even if it’s inconvenient. Occasionally the zen-like magic strikes me at 11:00pm and I make the conscious decision to ride it till it runs out, around 2:00- 3:00am. I'm not suggesting this is a good time to work, as you need to be well rested, but I am saying these sessions are so valuable (and frankly rare) that when they strike, it is worth the sacrifice to stay in them.

  5. Instant on. The moment you sit down and the screen turns on, start working. Literally do nothing else. Don't check email one last time, or order that thing off Amazon. — You can do all that later. Start writing code...now. Your brain will push back and try to distract you — you need to win this argument. Your brain will thank you later.

  6. Don’t reward yourself. Once in flow you'll start conquering problems left and right, but watch out! These little victories are a signal to your brain to chill out and celebrate the good times. You will suddenly find yourself randomly disengaging. — Don't fall for it. As soon as you solve one problem, instantly jump to the next, then the next. Let the progress snowball until your efficiency starts to die off.

  7. Know how much to sleep. Don't just Google "how much sleep do I need to sleep", you're a unique human being. My wife needs a solid nine hours every single night, I need about six. Everyone is different. Listen to your body, and then give it what it needs. If you're thinking about sleep while you're trying to program — you didn't get enough.

  8. Temperature. The temperature should be comfortable, but I've found that being slightly cold is better than being slightly hot.

  9. Wear comfortable clothes. I remember high school teachers telling me to wear comfortable clothes when taking the SAT. They were right, although, perhaps "comfortable" isn't quite the right word. The important thing is not to be conscious of your clothes (positive or negative), you don't want to think about your clothes at all.

  10. Hydrate & caffeinate. Drinking a glass of water ahead of time, and having coffee (if that's your thing) hot and ready is key. You don't want to have to get up for a while, so make sure your coffee is in a mug that doesn't get cold. I'm not saying that specifically coffee is needed but rather that it is important to consider and address your body's needs ahead of time so you don't get distracted. For me that “need” happens to be coffee, but for you that might be tea, fruit, or just a cup of water.

There’s more to work than flow

This article, rightfully, glorifies flow state. However, it's important to realize there is more to work than what occurs in flow. As developers, we're positioned in a market where our ability to rapidly produce high quality code is a great asset, but it's not our only one. Meetings, emails, code reviews, helping team members, writing blog posts and other important tasks are part of everyone's job and generally don't require the same level of hyper focus to accomplish. That's okay. When it comes to flow state, keep your powder dry, and your aim narrow. Don't get too down on yourself if you can't achieve flow state every day. While that's an admirable goal, our brains just won't always get there. Remember, there is plenty of other work that can be accomplished as a mere mortal too.

I hope you find these techniques helpful. If you're interested in hearing from me when you're not in flow you can follow me on Twitter @jpschroeder.

Discussion (0)

pic
Editor guide