« Scott Nonnenberg


Focus (Dev productivity tip #2)

2016 Oct 25

I’ve been told that I’m a very productive developer. And I’m sharing my techniques. Welcome to number two of my developer productivity tips: Focus.

Context-switching always has a cost, but it’s far higher in the realm of coding. Writing high-quality code requires deep focus, difficult to maintain in a hyper-connected world. Sometimes you’ve got to violate convention to do it.

A unique mental state

I discovered my propensity for deep focus early in my life, via video games. I’d get into the zone, make lots of progress and really enjoy myself, then be surprised when I saw the time. Hours and hours would go by and I would barely feel it!

Later, when I started coding, this was my target state. In college I’d clear a nice block of time in my schedule and sit down with an assigned problem. I’d ramp up, then stay in the zone until I was complete. And it didn’t feel like a slog!

That’s how I knew that the tech world was a place for me.

I believe that just about all of us in tech are chasing that feeling: a combination of novelty, really using your brain, and feeling productive by knocking down challenge after challenge. Video games set this up for you perfectly, with well-tuned rewards at small enough intervals to keep you engaged. Test-Driven Development (TDD) does the same, a new win with each new passing test.

Flow

This feeling is not a new concept, nor is it unique to technology. This phenomenon, generally called flow, has been described over the years by writers, poets, composers, scientists and more. Mihaly Csikszentmihalyi, the psychologist who came up with the flow name, believes that it is the key to human happiness. I’d recommend his TED Talk, “Flow, the secret to happiness” for a quick primer.

He says that three key components are required for flow:

  1. Goals are clear
  2. Feedback is immediate
  3. A balance between opportunity and capacity

Now that we have some idea of what we’re trying to do, and what it takes to get there, let’s cover some specific techniques for flow in programming.

Avoid flow breakers

Though I’ve thought about it a lot, flow is still a very ephemeral thing for me. I can’t just make it happen. The best I can do is leave space for it. So, I usually focus on avoiding things I know will prevent it…

1. Inadequate Context

If I don’t already have everything I need to write a given piece of code, there is a high risk I’ll leave flow state. I can sometimes hang onto it if I have research I can do on my own: a new API to explore or a spreadsheet somewhere with the deep specifics.

But if I need to involve someone else, I need to get into a different mode. And they might bring up distracting things from their own agenda!

I prefer to spend the time up front, carefully researching, planning for that deep focus. I discuss this process in my first post in this series: Dev Tip #1: Understand the Problem.

2. Distractions

Your open office floorplan, your home office, your officemate, your chatty coffee shop neighbor, the loud garbage truck just outside. All of these are common sources of distraction, anywhere from a mindless Nerf battle to a genuinely intriguing conversation. They’ll pull you away from flow. Headphones are the answer. When I want to be social I’ll take them off or go into a common area.

However, headphones won’t save you from Slack, gitter, push email, Facebook, Twitter or other random notifications. These are just as bad as a Nerf dart hitting you in the head. First, it will remove your focus. Second, it will tempt you to join in! Turn off as many notifications as possible, then be deliberate about your exposure to these highly distracting services.

I can hear it now:

“But what if someone needs something? Now I’m keeping them from being productive!”

Random notifications like a new email, or an @everyone or @channel in Slack, are absolutely worth turning off completely. Direct messages from people? This will require a little bit of finesse…

3. Interruptions

Conventional wisdom is that radical, real-time, cross-discipline collaboration is the new way to do things. Anything else is counterproductive and also a bit antisocial. But as in just about all of life, balance is the key.

Even at the Nordstrom Innovation Lab, where designers, developers, and user researchers worked together in a totally open workspace with few desks and no assigned workspaces, we still reserved time for deep focus. We sat down, stopped chatting, and got things done! The team understood the value of both deep focus and deep collaboration.

Kaas Tailored, an innovative furniture manufacturer here in Washington State, manages their totally open floorplan with different color cups hung above each desk - green means ‘feel free to interrupt,’ red means ‘do not interrupt,’ and yellow means ‘use your judgement.’

You don’t need to wait for your team or company to start doing this. If the people around you haven’t internalized the need for focus yet, it’s up to you to push things in this direction. The key is to set expectations. Slow down your average response time, but give people an out if it’s particularly important that they get a response quickly. You could perhaps try something like office hours, a set time where you’re responsive, and other times contact should be for near emergencies.

The Pomorodo Technique might also be helpful. Using its system, every half-hour is broken into 25 minutes on task, then a five minute break. Now imagine synchronizing those blocks across your team!

As you set expectations and experiment with different systems, you can work to eliminate the root causes behind the interruptions in the first place. More automated processes, better documentation, and more record-keeping can all reduce high-urgency interruptions.

4. Open loops

Now, back to your own brain. An open loop is when you have something in the back of your mind taking up space. Many times a nagging worry of some kind. Maybe an upcoming deadline. Or the knowledge that you have something on the calendar in an hour. Or you really have to pee.

First, go to the bathroom! :0)

For nagging thoughts or worries I can’t deal with right now, I find that recording my concerns in a notepad helps me focus on the topic at hand. And it gives me a list of things that must be important to me in some way!

Impending deadlines aren’t so easy to forget. But even those quick glances at the clock will break your flow! I’ve found success in setting a timer. If you have to start getting ready to go somewhere at a certain time, set at timer for that time. If you have a deadline coming up, set a timer for the last responsible moment for telling people that you’re not going to hit it. If you’re not in a comfortable position by then, you know what to do. But until that timer goes off, you can focus completely.

5. Not ready for flow

Even after all that prep work, sometimes I sit down with a nice block of time ahead of me, and it doesn’t happen. I seem to have all ingredients in place, but I find myself itching to check social media or go read an article. When that happens, I set a short timer and force myself to get away from my screen.

I’ve discovered that in many cases what looks like an inability to focus is really a need to let your subconscious take over for a bit. And in that situation, what you need is emptiness. Social media will introduce more distractions and will ultimately slow or block that important work. A communal, social space is a step better. The best for me is meditation in silence, or a walk in nature.

Don’t let anyone tell you that this time away from your keyboard isn’t productive! There’s nothing better for working through a tough problem!

Honoring the subconscious

Do the work to preserve space for your whole mind to work. Maybe you need music instead of silence when you meditate, or a quick run really activates your subconscious on a problem. Experiment!

Once you identify your needs, build structure around them. Set expectations with those around you. You’ll be a whole lot more productive!


A little bit more:

I won't share your email with anyone. See previous emails.

NEXT:

Breaking other servers with Node.js 2016 Nov 01

If Node.js is good at anything, it’s efficient use of local resources in the face of substantial parallelization. It’s easy to write a Node.js program which has many, many different things going on... Read more »

PREVIOUS:

The technology side of Agile 2016 Oct 18

I’ve already written about why Agile is interesting in the first place, and how you might customize its application for your team. The hard truth is that you can’t become Agile overnight. People... Read more »


Hi, I'm Scott. I've written both server and client code in many languages for many employers and clients. I've also got a bit of an unusual perspective, since I've spent time in roles outside the pure 'software developer.' You can find me on Mastodon.