3 Tips to Stay Focused While Coding

I’m kind of a productivity nerd. I really love reading articles, books and blog posts about tips and techniques that help me get more done, beat procrastination and improve efficiency and motivation. And while there are lots of different approaches and not everything works for everyone, one common theme is always present: The importance of focus.

Science and empirical knowledge made it pretty clear that nothing is as detrimental to ones productivity as being easily distracted. Unfortunately it has never been harder to focus than today, with all the push notifications and quick access to social media channels. Seriously, if you want to get something done, you have to keep your head together. So let’s talk about a few tips and techniques that will help you improve your focus when you are doing what you are here for: writing code.

To keep this list short, I will talk about the 3 things that I found most beneficial for concentration in my own work.

 

1) Put your phone away

The first thing I do when I know I have to focus, is setting my phone on do-not-disturb mode and then putting it somewhere I can’t see it. Don’t just put it away, make it silent (with no vibration). You don’t want a ringing or buzzing to kick you out of your flow. I used to have my phone on a mount on my desk, but this is a big mistake, because nothing is worse for your concentration than notifications blinking into your face.

Social media is fine and can be entertaining and even helpful, but always keep in mind that these companies try to make you as addicted as possible to their website, because the more time people spend on there, the more money these sites make. Every time your phone makes a sound or blinks because you received a new message, a little bit of dopamine gets released in your brain. Dopamine is the hormone that motivates you and makes you want things. That’s why it feels so good and exciting to get a notification or feel that vibration in your pocket or just see a little “1” bade on your messaging app icon. Because these things trigger your hunter-gatherer instinct.

But distractions interrupt you, have switching costs in terms of time and efficiency  and more often than not you can’t stop scrolling through your feed for the next hour or two. There is a concept called “variable rewards” that makes these social media feeds so incredibly addicting. In short: the search for the next exciting, funny, cute, sad or just cool post has a similar effect on your brain as gambling, because you don’t know in advance when you will find (or win) something valuable the next time. These random rewards are especially effective in triggering dopamine responses and therefore much more addicting than rewards with a fixed frequency. If every post in your Facebook feed was interesting, you would actually have an easier time stopping to scroll, because the excitement would vanish more quickly.

If you want to know more about this, check out the book “Hooked” by Nir Eyal. I can highly recommend this read. It will help you understand how these companies get you hooked on their product/service.

The bottom line is: Keep your phone out of sight and make it silent when you work. Even if you think you have it under control. 

 

2) Listen to video game music or white noise

Right now I live next to a bakery/restaurant, and since the landlord thought it would be sufficient to put a thin wall that blocks as much sound as a piece of paper between them and my apartment, I really had to learn how to isolate myself from loud noise while trying to focus.

Until recently I always listened to video game music on Youtube while working. For some reason it immediately invokes positive emotions in me, even tho I didn’t play most of these games. There is something about game soundtracks that makes them really good in giving a warm and happy feeling. Plus video games require similar amounts of concentration as work and therefore these soundtracks are made to keep you focused. However, they are still more distracting than no music at all.

Nowadays I prefer white or brown noise. These are just signal noises that are pretty neutral and almost disappear from your consciousness after a while, but they do an awesome job in drowning out other noise, especially with in-ear headphones. You can find them on Youtube as well. Maybe you have to get used to them at the beginning, but they helped me from the first minute.

So white and brown noise are my favorites for focus, but I still pick the video game soundtracks from time to time, because of their positive effects on my mood. If you never cooked a meal while listening to the “Sims” soundtrack, you have missed out.

I can recommend these cheap but good in-ear Bluetooth headphones. I prefer them over normal headphones because they block out environment noise better.

I hope one day I will live somewhere where I can enjoy complete silence, but until then these soundtracks and noises will keep me sane.

 

3) Meditate

When I told my mother that I meditate for a couple minutes every morning, she thought I went crazy and told me I shouldn’t waste my time with stupid stuff like that. While I can understand that the older generations are suspicious towards uncommon/foreign practices like that, I find it a bit sad that a lot people still think meditation is something “stupid”, while it is scientifically proven to have a ton of positive effects on the brain.

Meditation not only reduces stress and anxiety and calms you down, but it also helps you control your emotions better, which makes you less likely to give in to every impulse of distraction. This lets you focus on a task for longer periods of time, and it also makes you less likely to procrastinate, because procrastination is more about anxiety and fear than about laziness.

Different forms of meditation help with different kinds of cognitive abilities. Some forms, like the “open monitoring meditation”, help you become more creative by observing your thoughts without judgement and letting them flow freely. But since I am more interested in improving my focus, I mainly do the so called “focused attention meditation”, for which you put all your focus like a laser onto one single object or sensation (like your breath) for a couple minutes and immediately bring it back whenever your mind wanders off. When you try it, you will realize how incredibly hard it is to stay focused onto one single object, and random thoughts will pop into your mind all the time. But this is exactly the reason why you should practice it. You want to be able to keep that laser-like focus. And since it only takes a couple of minutes every day, it is an absolute no brainer in my opinion. There is no reason you should not do it.

If you want to get started with meditation, check out the book “Real Happiness” by Sharon Salzberg.

 

Focus is important if you want to achieve anything. Treat it like a skill (what it is) and work on it. I hope my 3 tips will help you along that process. For further reading on the importance of focus I recommend “Deep Work” by Cal Newport. It’s a great book.

4 thoughts on “3 Tips to Stay Focused While Coding”

  1. Good job . thx for help im tidiani niassi i follow you on YouTube
    Thx for this articles thar help me to have a great performance i wait the next
    Coding ans learning become esay with coding flow

Comments are closed.