Many programmers don’t get the most from their programming hours.
In large part, this is because most workplaces don’t emphasize peak performance. Long slogs may be spent at the computer, but how much quality programming is really getting done?
A programmer has been glued to their seat for hours and is getting nowhere. Slack messages zoom across the computer screen, diverting their attention. Feeling mentally drained and physically sluggish, their focus slips, errors happen, and they begin to go through the motions.
Here’s an opportunity for programmers of all levels.
How do you get into your peak and maintain it throughout your day? The answer forms the crux of this article. I call it “ten-mode.”
On a scale from one to ten, you’re programming at a ten — at your peak — instead of a five when you settle into a mental fog and go through the motions.
In ten-mode you can:
- boost your productivity,
- accelerate your learning, and
- enjoy the process.
Plus, you’ll probably find yourself making fewer mistakes when you’re at your best, and therefore saving yourself loads of time and frustration in the process.
I turned to ten-mode when I began learning to program while maintaining a full-time job. I needed every hour spent programming to count.
Now I can’t imagine programming without it.
Ten-Mode in Action
Ten-mode is an intense period of high-quality focus on one thing — without distraction — followed by a break, or a period of unfocus.
It consists of two parts: managing your energy and managing your attention.
It’s circular: you manage your attention in order to have radical focus as you program for a period of time. You manage your energy so you can do it again.
The best way to understand ten-mode is to see it in action. Here’s an example from my life.
It was 9:30am on Saturday. I just got back from a twenty minute walk outside: a break between two programming sessions, or blocks of time spent programming. I felt great physically, and mentally I was refreshed.
I was at a ten.
I pulled up Evernote on my computer to see what I’d be doing for the next two hours. It looked like this:
9:30–11:30am — Program
→Build tablet version of index page for web design project
- Add media query at 700px
- Ensure the mobile version still works properly once tablet version is complete
- Last fifteen minutes, review “Python” Anki flashcard deck
The arrow denotes the main task, with two smaller tasks to help me get there. Plus, I begin or end each programming session reviewing flashcards on Anki.
The volume on my iPhone was turned off and out of sight. All internet tabs unrelated to the project were closed. My noise-canceling headphones were on.
Nothing else mattered, except the task at hand.
But ten-mode comes at a cost: you can’t be at 100% all of the time.
So once 11:30 hit, I took another break. And this brings us to the first of two major components of ten-mode: managing your energy.
Program Like an Athlete
While training for the 2008 Olympics, Michael Phelps often had an early morning practice and then another one in the late afternoon, with a nap in between.
“Believe me,” Phelps writes, “working out that hard in the morning and then again in the afternoon made a nap no luxury. It was an essential.”
Sprinters don’t sprint eight hours straight. Pitchers don’t throw pitches all day. And Phelps wasn’t swimming all day.
As most athletes will tell you, downtime is essential.
In order to have these highly intense, highly productive ten-mode sessions, we need periods of unfocus. A period of rest and recovery allows you to recoup your energy and focus so you can pick up said activity again and operate at a ten.
As much as I’d like to program all day straight, I can’t — not if I want to write quality code and learn as much as possible.
Eventually, my attention will slip. My focus will falter.
As a result, I’ll make mistakes or confuse concepts. Worse, I’ll go through the motions: running the same test and getting the same error. Instead of my best work, it’s mediocre work. Instead of taking one hour, the task takes two.
These things happen because I’ve slipped from a ten to a five.
In order to have a high-quality, high-focus programming session, you’ve got to have periods of unfocus. Give your brain a break from what you’ve put it through the past few hours, and let the information solidify.
Get up from your chair and take a walk, workout, or do some pushups. When I manage my energy physically, I give my mental energy a boost.
Return to your work physically and mentally rejuvenated with fresh eyes and a clear mind that’s full of ideas. You’re back into ten-mode.
Schedule your Breaks
“Taking breaks sounds great in theory,” you may be thinking. “But who has time for them?”
The solution is easier than you think: schedule breaks during your day.
I work in blocks of time, which are usually two hours long. After that block I take a legitimate break, which is typically a twenty minute walk outside. At lunchtime I also workout, so my break is a bit longer.
For example my break schedule often looks like this:
- 9–9:20 — walk
- 12–1 — workout
- 3–3:20 — walk
The physical activity and change of scenery are helpful. But not staring at a computer screen and thinking bring the most relief. I return feeling refreshed and ready for the next session ahead.
I’m at a ten.
The time spent breaking means time that’s not spent programming. But that’s time well-spent.
You’ll program better if you take the break.
Here’s why: your brain doesn’t stop working just because you do.
Taking breaks can generate new ideas. If you’ve ever had an idea pop into your head when you’re doing something other than programming, then you know what I mean.
It’s no coincidence that you arrived at your solution when you were doing something else — when you weren’t deliberately working. “Epiphanies may seem to come out of nowhere,” explains Scientific American, “but they are often the product of unconscious mental activity during downtime.”
Breaks can also zap that mental fog. So the obvious is no longer overlooked. A clear mind and eyes can more readily and easily spot the details — like that misplaced semicolon that was causing the error.
Plus, it takes time to detach from the problem that you were working on, or the concept you were trying to wrap your head around. So take more than a five-minute water break. I find that a solid break helps me get into a more relaxed frame of mind, which is when ideas tend to spark.
Above all, breaks can restore your energy and attention so you’re operating at your peak.
Taking a break is useful. But equally important is the break itself.
It’s an easy trap to fall into. I did early on when I began to program.
Some programmers advocate being connected to something programming-related at all times, even during breaks. Watch a lecture on a technical topic while you workout. Or listen to a podcast while raking the leaves.
Feeling pressed to learn a mountain of material, I took that advice early on and began consuming programming topics during breaks. I’d flip through Anki flashcards while sitting on the train. I’d listen to a podcast while walking. Not a minute was wasted.
But interestingly, little was gained.
The problem is you never fully disconnect when you’re constantly consuming information; your mind never gets a break from what you put it through during the hours spent programming.
As a result, you don’t enter your next programming session fully recharged at a ten. The so-called break didn’t do much good.
Nor did you fully absorb the new material you’re trying to consume. It’s very difficult to learn a technical topic while on the elliptical machine.
I came to this realization when my iPod died one day, forcing me to do a spinning workout in silence.
Surprisingly, I really liked it.
No inputs meant that I was entirely focused on my workout. More importantly, no inputs left me mentally ready for the next work session.
Instead of cramming my mind with more stuff, I gave my brain some time to digest everything I put it through that morning. I returned to my work at a ten.
If you’re going to program, then program. If you’re going to learn a new programming topic, then learn it. But if you’re taking a break, then break: do something other than program. Make your breaks worthwhile, so you return to your work ready to go.
At the same time, figure out what’s going to give you the boost to be at your best. For me, it’s walking or exercising without inputs. Other ideas include reading or meditating.
Whatever you do, don’t stay cemented in your office chair scrolling through social media on your smartphone for twenty minutes. Afterwards, you’ll still feel sluggish. Worse, you’ll fill your head with distractive information that can stay stuck in your mind.
Then, make taking breaks a priority. You’ll amaze yourself at what you get done.
The Attention Zapper
You’re programming and a new Slack message flies across your computer screen. You click on it: donuts are in the kitchen.
Thirty seconds later, another message zooms in. The sales team is having a record-setting month. Then, your phone beeps with a new text.
Your attention is everywhere and nowhere.
The slew of interruptions are distracting and mentally draining. That’s a problem for mentally demanding work that requires a lot of focus, like programming.
This scenario points to the second part of ten-mode: managing your attention.
Again, let’s think of how athletes work.
Have you ever seen a sprinter run a 400-meter dash while texting? How about a point guard dribbling down the court while on Slack? Or a swimmer swimming laps while scrolling through social media?
Of course not.
Slack, texts, and social media may be part of an athlete’s life — but not while sprinting around the track, dribbling down the court, or swimming laps.
They’re not multitasking; they’re monotasking: they’re entirely focused on their core activity.
Programming should be no different, which is why the second component of ten-mode is managing your attention so you can have radical focus.
Digital devices can be a lifesaver when used appropriately.
But they can also be among the biggest attention zappers: wreaking havoc on your attention and mental energy if you let them.
It’s a lesson I learned the hard way a few years ago while on deadline for an article.
I’d planned to make significant progress on it one Saturday morning. Before I pulled up the article, however, I checked my email.
A seemingly innocent decision was a crucial mistake.
I received a message from an acquaintance that put me in a distracted state. I couldn’t stop thinking about the email — and how I should respond — as I tried to work on my article.
Unsurprisingly, it’s hard to make progress on one thing when your mind is stuck on something else. In fact, there’s a name for this phenomenon.
“Attention residue” is what Sophie Leroy, a business-school professor at the University of Washington Bothell, calls it. It’s when you keep thinking about the previous task after switching to a new one. In my case, I kept thinking about the email and how I’d handle the situation while trying to write an article.
That experience was a turning point for me.
I learned how fragile our attention really is, and I’m reminded of that each day when I set out to program. Now I check my personal email after my programming and writing are done for the day, if at all.
But I can’t get away with that at my day job. While I need to be responsive, I don’t want to be distracted.
The solution is simple: be proactive instead of reactive. Decide in advance when you’re going to check digital tools at work and only check in during those times.
That way, there’s a clear distinction: you’re either working or responding to colleagues — you’re not doing both at the same time.
Each day I decide in advance when I’m going to log into Slack and email to handle work correspondences. I only use digital devices during those times.
Designated checks are just part of the equation. The other part is how to handle these checks: give yourself time to get back to people.
It takes more time and attention to constantly check your email or Slack and do nothing about the messages contained within.
Worse, it consumes your mental energy. You don’t want “attention residue” to wreck your next session because you’re thinking of all of the people you need to respond to.
So check-in, respond, and then sign off until your next check-in.
That’s the critical point: don’t hang out on digital devices all day.
Close the tabs until the next designated check-in time. That way there’s no icon bouncing up and down alerting you of messages; no notifications zooming across your screen.
Eliminate all possible distractions, so you can get back to ten-mode and get quality work done.
It’s Not that Urgent
“But what if there’s something I really need to know about?” you may ask.
Messaging platforms, like Slack, make everything seem urgent. The idea is that you can get a hold of people immediately, so they can respond immediately.
This often creates a false sense of urgency. It also slices your attention into many pieces. Besides, topics that are in fact urgent or critical aren’t discussed over Slack, at least in my experience.
I’ve been working this way — checking and responding to digital messages at specific times — for several years now. I’ve never had an experience where a topic was so crucial that it couldn’t wait until my next check-in.
Nor have I ever been asked to hang out on Slack longer or more often. In fact, the biggest challenge for me was getting over that addictive sensation to constantly check digital devices. (The good news is that it does subside.)
What’s more, many times these messages have nothing to do with work. It’s fine to stay in the loop with pictures, jokes, random news, and food statuses in the office kitchen.
But you don’t really need to be interrupted about these things in the middle of a mentally demanding task.
We have a finite amount of mental energy to use each day. That’s why the single best way to overcome distraction is to prevent it in the first place.
Radical Focus on Short-Term Goals
The core benefit of managing your attention is having radical focus for a period of time on one thing.
Instead of having your head swarm with activity, you’re radically focused on one thing — the goal you created in advance, which I refer to as a “session goal.”
“Build tablet version of index page for web design project,” was my session goal in the example provided at the start of the article.
A session goal gives you something concrete to shoot for.
Saying you’ll “program for two hours” or “work on a problem” is vague and abstract. In contrast, “build out the tablet version of the index page” or “solve ‘Remove Element’ on LeetCode” is specific and concrete.
That way you show up prepared.
There’s no question whether you’re programming. Or what you need to work on. Or how long you’ll work on it. All of these details have been figured out in advance.
The guesswork has been eliminated; just implement the plan.
Besides, you can program for two hours and not get much done. But a session goal will help you hold yourself accountable: you’ll have immediate feedback after the session ends.
Did you solve the problem? How many tests did you get to pass? Did you build that webpage?
You’ll have answers to these questions — and get more from your programming hours — when you identify your programming session goal.
A Paradigm Shift
When we think of working at our peak, we think that’s something that’s reserved for select people, like athletes or chess geniuses.
But that’s simply not the case.
We, as programmers, ought to do what it takes to work at our peak — to program in ten-mode.
The benefits are well worth it.
Most obvious, ten-mode has been a huge boost to my productivity. I’d guess that two hours spent in ten-mode are probably equivalent to four hours if I were at a five.
It’s also accelerated my learning, and it’s easy to see why: learning comes a bit easier with a clear, rested mind.
Above all, programming is far more enjoyable. And in the end, that’s what it’s all about anyway.
- No Limits The Will to Succeed. Michael Phelps with Alan Abrahamson. Free Press. 2008.