If you're a programmer, learning how to focus is crucial if you want to have a long-lasting, successful programming career. After all, few other careers require the intense, constant focus that programming does.
But it's not easy to stay focused for a long time. Our minds wander when they shouldn't, we grab our phone instead of reading the code in front of us, we browse Twitter instead of writing out that JavaScript function, etc.
This article will first define what focus means, after which it will go over 4 practical ways to help you focus better.
What Is Focus?
Merriam-Webster defines focus as directed attention. It's the ability to narrow your attention onto one specific thing for a prolonged time period. Everyone can focus, but some can focus much longer than others can. In fact, when someone says they cannot focus, the problem isn't that they cannot focus. They just cannot focus for long enough.
If anything, our brains can only ever focus on one thing at a time. This explains why multitasking is bad. It's biologically impossible to focus on two things at the same time. When we multitask, we rapidly switch focus from one task to the other and back, as if we're playing mental ping-pong. This has a switching cost that makes us less productive. Don't multitask; complete tasks consecutively instead.
4 Practical Ways to Focus Better
Choose Your Big Rocks
Much of focus springs from organization. On the morning of a working day (or the night before), choose a maximum of three big tasks that you want to complete that day.
These are your big rocks. They are non-negotiable; you have to complete them. All other tasks are secondary. Schedule your big rocks when you know you have the most energy, whether that's morning, afternoon, or evening.
Your big rocks have to be big enough to take up a large chunk of your working day, but small enough that you can complete them in a single working day. "Reply to my colleague's Slack message" is too small, while "program a client website" is quite likely too big.
Add Feedback
Choosing your big rocks will make it easier to get yourself to focus. But that's only one part of the equation, and it's the easiest part. The hardest part is staying focused. You're probably reading this not because you cannot focus, but because you feel you cannot focus for long enough.
Feedback is vitally important for staying focused. Our brains naturally search for problems to solve. If what we're focusing on doesn't seem like a problem, or if it doesn't seem as if it can be solved, we look for something else to focus on.
That's why our minds wander when we do things we consider easy, things that we've done many times over. That's why we can "switch off" for certain tasks, like doing the dishes, pulling weeds, or ironing shirts. Our brains don't consider these as hard problems that need solving.
So add feedback to the process you want to focus on. Split big tasks into smaller ones. Frequently test your code for bugs. Track whatever it is you're doing. Introduce some kind of mechanism that frequently tells you whether you're still on the right track or not.
Feed Your Brain Fewer Distractions
Today's world is one of constant, intense stimulation. Messages, pings, emails, pop-ups, banners, notifications, etc. Problematically, our brains reward us with dopamine, the pleasure chemical, for much of this stimulation. That's why it's easier to browse Facebook than it is to write code. Not only is browsing passive, but Facebook is designed so our brains release dopamine scrolling it.
We all need to remove some of that high-intensity stimulation from our lives. When you're trying to focus, put your phone in another room and close any programs that might ping you. Another good tip is to remove the desktop menu bar of your device, so you're always in full-screen mode of whatever program you're working in and cannot be disturbed by, for example, an incoming email.
But we need to do more than that. We can focus better when our minds have had time to relax and wander. Remove things of high stimulation for things of low stimulation. Go for a walk instead of watching the umpteenth installment of Fast and Furious, do the dishes without listening to a podcast, read a book instead of watching YouTube. Reintroduce a little boredom.
While you don't need to eliminate all high-stimulation activities, consider your current environment and how much it puts your mind on edge. Can you make it a little less interesting? A little less engaging? Remove what pulls on your focus that shouldn't.
Put in the Work
Time for a reality check. Focus is also tied to motivation, and you won't always be motivated for whatever you're doing next, even if you love what you're doing. You might love being a Go programmer, but you won't always love going to work.
The difference between those who make it and those who don't is that those who make it still show up every day, despite their feelings. Everyone will have bad days. But the best programmers show up on bad days and put in the work. It might be a little harder to focus, but they still make it happen.
This is particularly true if you want to achieve mastery in your field. Mastery requires constant practice and repetition of things that might be terribly tedious. It will be hard to always find the motivation and the right focus for these repetitions. But if you want to achieve mastery, you push through your feelings and do it anyway.
In Conclusion
Being able to focus intensely for a long time is crucial for a successful career in programming. You can improve your focus by choosing your big rocks before you start work, adding feedback to your processes, removing some of today's omnipresent distractions, and simply pushing through your feelings and putting in the work.