Maximizing Deep Concentration While Coding

Creating the right conditions to get into the zone.

In my teens and early twenties, I could enter a trance-like state while coding. A deep sense of concentration, where nothing was going through my head, except, the algorithms, problems, and state of my current dumpster fire of an app. Somewhere along the way, I seem to have lost the ability to enter that hyper-focused state. My coding skills have improved immeasurably since then, and so did my knowledge of all the problems I will inevitably encounter. I figured I had just grown out of it. It could have been all the planning ahead, or the boredom of re-implementing the same solutions to problems I have solved dozens of times already. Everyone grows and changes, and eventually, we can’t quite get back to Never Land.

In the middle of the pandemic, freshly without a job, I started working on my own project. I wanted to make a project I would actually launch, not a side project, not a toy to try out new technologies. Really take it all the way.

Spoiler Alert: I didn’t, read more about it at the end of the post. What I did do, was fall in love with coding again. I found my zen. Somehow, I could spend 10-16 hours, coding again. I found new techniques, frameworks, and paradigms fun to learn about again. I think most importantly, I noticed that my trance-like state was fragile, and only happened in the right conditions. Now, I know what Peter must have felt like.

Creating the right conditions

I started to take note of the conditions when I found that I was in this state of deep focus, and here is where I am at.

To Stand or Not to Stand

In my twenties, I ruptured my achilles, and then gained some weight. It’s been a struggle ever since. Never quite got back to fighting shape. One of the things that helped get the weight gain under control was a standing desk. In addition to helping with back problems, standing burns more calories than sitting. Great for your health, and I have been a huge advocate ever since.

I have come to realize, standing was one of the things that make it hard to enter my coding Never Land. Once I got used to standing, I stood all the time. Yep, full 8+ hours per day in most cases. My back problems went away, and I stopped gaining weight. Of course, I added some exercise and diet changes as well.

Over the last year, putting tons of hours into my new project, eventually, I got tired of standing and actually put my desk into a sitting mode for a bit. Magically, I found that I had started really getting in the zone while sitting. It took me a while to realize, but almost every time I was really in the zone, was at the end of the day. Coincidentally (not a coincidence at all), that’s also when I got too tired to stand and had switched to sitting mode.

Realizing that it was the sitting itself that was helping me focus, I had to rethink my whole routine with regards to my workday. I am still a huge advocate of the standing desk, do not get me wrong. Buy one, immediately, it’s great for you. Just don’t stand all the time.

Sitting all the time isn’t great either. I started standing for a reason. So I created a routine.

  1. Stand in the morning.
    During this time, I specifically don’t start big programming tasks, or really program much at all. I do everything else, all the chaotic things: Meetings (if you have a choice), organize tickets, research whatever, triage bugs, etc…

  2. Sit and code in the afternoon.
    After I take a walk for lunch, or whatever, the Desk comes down, and it’s focus time. Turn on Do Not Disturb mode, and get some shit done.

Even when I am sitting for a few hours, I make a point to stand up and walk away from the computer rather frequently. Refill my water, use the restroom, or whatever. The key to staying in the zone, for me, is to stop sitting, but keep thinking. Use the walking time to consider whatever your current issue is, without looking at the actual code. Oftentimes, while away from the computer, it dawns on me that my whole approach is wrong. If I do something just a bit different, a lot of current problems could be made non-existent.

Intermittent Fasting

Another recent strategy for losing weight. It is working great!

Another non-coincidence is that I found I was really getting in the zone recently, and I think it lines up with when I started IF. I didn’t really collect any data on it, so it’s a little hard to pinpoint. But man, afternoons recently, I have just been 🔥. I’ve been as productive as I ever have been.

I’m on a 20:4 routine. This means I fast for 20 hours a day, and freely eat like the fat kid I am for 4 hours a day. I start Eating at 5:30 PM and stop at 9:30 PM. I have been using an app called Fastic (no that’s not an affiliate link).

A nice feature of this app is that it tells you approximately what’s happening with your hormones at the different staging of fasting. Once I read about the ketosis stage, things started to click. It says that about 12-16 hours after you eat, you enter a stage called ketosis. According to the app, ketosis can improve focus and productivity, and I should be entering ketosis sometime between 9:30 AM and 1:30 PM. Coincidentally, 12 - 1 is about when I sit down, and I really start to get shit done.

I can’t really tell you, for certain, if ketosis is really that helpful, or it’s a self-fulfilling prophecy. Honestly, I’m not sure I care. I’m losing weight, I love my work, and I have found my happy place. I can fly back to neverland.

A few Extra Tips

Besides trying to improve my productivity, I’ve been working remotely for a long time, and I have learned a lot about staying sane, and productive along the way.

  1. Stay at least a little active
    Walking actually burns quite a lot of calories, compared to the effort you put into it. Walk frequently, just outside the house, or whatever doesn’t have to be a big deal. Something is deploying? Time for a short walk while you consider what next to work on. Most of the time I do this during the standing part of my day, but I try to do this while sitting as well.

  2. Pomodoro Timer Wait, hear me out, it’s not the typical pomodoro advice
    I use a pomodoro timer during the “chaotic” morning routine. But I don’t take a break in every 20 minutes. Instead, I exercise, in any way. I have a pull-up bar, and sometimes I just run over and hang for a minute, maybe throw a few actual pull-ups in. I have some adjustable dumbbells. Sometimes, I’ll just do a handful of curls or swimmers press. A few burpees, a vinyasa, even just some stretches. Whatever feels good at the time, don’t overthink it. But get the blood flowing a little bit, for like 1 minute. That is literally 3 minutes out of every hour. You won’t miss it.

    The key here, for me, is I take this time to consider if whatever I am doing during that 20 minutes was a good use of my time. Often it wasn’t, and I should finish up and move on to something more valuable.

  3. Communicate with your co-workers
    It’s easy to overlook communication, now that we are all mostly remote. People can’t see that you are burnt out, tired, or that you have been working hard. One-on-one video chats don’t give you zoom burnout nearly as bad, so do them frequently. Audio only is a good way to avoid zoom burnout as well. Hell, pair program all the time if you find it helps with the social aspects of your remote work. Just don’t get too distracted and goof off all the time, or make someone feel like they have to be on video with you all the time.

    When I switched to working from home, I found that I worked waaaay more hours. There were no shoulder taps, no “hey can you help me with this real quick”, no coffee walks, water cooler gossip, no bullshit. Eventually, you realize, you need the bullshit. The bullshit is where human beings connect and feel like they are part of a team. Sacrifice some of your productivity, and bullshit for a bit with your co-workers. Overall, working remotely, you're probably still going to more productive than you were when you had all the distractions of the office.

  4. Make your work visible.
    Employers can be nervous that their remote employees are just playing PlayStation or whatever. Try to get in the habit of posting updates to slack (or wherever), about what you are working on, and any issues you are having. People are usually glad to collaborate, and when they think back on whether or not you seem like you are working, or playing Xbox, they are more likely to remember all the conversations, and err on the side of “probably mostly working”.

  5. Block out your focus hours
    This doesn’t apply to everyone, but if many companies have chaotic schedules, and meetings all over the place. If you put a daily event on your calendar, where you are shown as busy, meetings are likely to be scheduled around that. Let your boss or co-workers know that’s what you are doing, and that you think it will be good for the company overall. If there really is a meeting that is important and can only be done in those hours, they can reach out and ask you and you will make an exception. In my experience, there is rarely actually a meeting that is so important, that it can’t wait until tomorrow morning. If you can get your whole department/company on board with meeting free times, even better. If someone adds you to a meeting during your focus hours, without reaching out first, reject it. If they really want you there, they will reach out, and explain why it needs to happen during those times. There are even times when I have let someone know that I can join their meeting, but I am going to be working, and likely not to be paying attention unless you get my attention.

    The key here is not to be a jerk about it. Make exceptions pretty easily. Sometimes it is hard to get everyone in at the same time. It’s better to be generous with your time. No one wants to work with the Grinch. See #3.

My little side story, for the curious

The app idea was simple. An always on game for people working remote. Everyone in the virtual office will have an audio connection. The further away you are, the more quiet someones voice would be.

I still haven’t launch my app, and I might not ever. seemed to come out of no where right before I was about to put out my MVP/POC. And Gather Town was way better, implemented most of the features I wanted to have, plus a few more, was more stable, and had video.

Suffice to say, there was no reason to launch and poorly made, POC, when one already existed, and was crushing it. I still dragged my app out for quite a while though. Improving stability, switching to a direct p2p mesh network to keep costs down, and creating apps. I thought, maybe, I could capture a niche audience of people who wanted an always online office with only audio. I spent another couple months rewriting almost all of the POC, so that spatially aware audio could be running without the actual game loop running.

I had a few friendly users test it out, and got largely mediocre feedback. The app wasn’t sticky enough, almost no one in the office was using it, and so those that did, stopped turning it on. Instead of an electron app, maybe I should make it a Chrome/Firefox extension, that way it’s open as soon as someone opens their browser! Great idea! Except I just don’t have any wind left in the sails for Tengable. I’m still not super happy with my code, Gather Town is significantly further ahead of me, and now slack and clubhouse have begun to encroach on the space.

It’s pretty clear to me that I need to either:

1. Raise money, quit contracting, go full time, and actually take a real shot at moving fast with my app.

  1. Consider the gamblers fallacy, take my learnings, and move on to something new.

I came across a few people to start a new company with, and I have decided to go down that route instead. So I guess it’s option 2 for me. I may still put make a chrome extension, and publish it. Just to call it done. I’ll probably open source the code as well. Why not. Maybe people will take it and make it their own.

Tengable is my project, for the curious.