Three Ways for Software Engineers to Improve Their Focus

Writing software requires an intense focus. A software engineer is juggling a number of different pieces of information in her head, and needs to focus on how these different pieces of information connect to one another. A loss of focus can totally derail what was being worked on. This will lead to bugs, inefficient code, and a waste of time while the engineer regains focus.

Writing software takes the engineers into a state of flow. Flow is an intense state of focus described by Mihaly Csikszentmihalyi in his book Flow: The Psychology of Optimal Experience. The flow is broken if the engineers losses focus. This can be caused by anything, from someone talking to the engineer to having to go to the bathroom to getting a phone call. These distractions destroy a state of flow. However, to get into a state of flow a software engineer needs to be able to focus. This means being well rested, physically healthy, and able to have a clear mind without any distractions.

There are tricks that a software engineer can use to help increase their focus. This will place the engineer into a state of flow more often, leading to better productivity, less bugs, and cleaner code. Being able to fully focus on the code will lead to more efficient code.

Here's a few simple lifestyle changes that a software engineer can make to improve their focus. A lot of these may sound obvious, but I was surprised to see how many engineers do not do these things.

Get Enough Sleep

Sleep is super important. The best book I read last year was Why We Sleep, which explains the importance of sleep and how it impacts our everyday life. Sleep is super important to productivity and efficiency. If you want to be effective in how you live you life, be sure to get enough good sleep.

Getting a good night's sleep means sleeping somewhere dark, quiet, warm and comfortable. For me some nights are better than others. It seems like one night I am able to fall asleep and instantly go into a deep, restful slumber. Other nights I lay around tossing and turning.

But I have been able to do a number of things that have helped me improve my sleep quality. The first and most important was to buy some blackout blinds for my bedroom. These are a cheap way of blocking out the morning light. I wake up around 8am, well after the sun is up. These blinds help me stay asleep while the sun is already up. Without them, the outdoor light would start to fill my bedroom around 5am during summer. I respect folks who wake up at 5am, but that is not me. I want to sleep in. Keeping my bedroom dark is super important for me to be well rested.

Another factor that has really helped me sleep better is getting a pillow specifically made for side sleepers. In the past I would sometimes wake up with headaches, even though I slept fairly well. These headaches really interfered with my day and my productivity. It was hard to focus on my code when my head was throbbing. Getting a pillow specifically designed for side sleepers has had a dramatic effect on lessening the amount of headaches I wake up with.

Finally, noise reduction is great. I have a Google Home in my bedroom and at night I ask it to play "ocean sounds". This is a pleasant white noise that drowns out sounds that might wake me in the middle of the night or the early morning.

These three simple additions to my bedroom really helped me get a better nights sleep. Doing so has drastically improved my attention span and focus. I feel well rested and am able to be productive as soon as I get to work.

Eat Healthy

Software engineers are notorious for eating poorly. The image of an overweight nerd surviving off nachos and Mountain Dew soda is what many people imagine engineers to look like. While most software engineers eat healthier than just junk food and soda, there is a lot of ways to improve ones diet.

Improving dietary habits is hard, especially because there are so many different, sometimes conflicting, diets out there. But there are a few commonly agreed upon things that almost all nutritionists and doctors will tell you.

Eat more plant based foods. Meat is bad for you, vegetables are good for you. It's a simple rule and has a ton of science to support it. You don't have to go full vegan or anything, but cutting down on read meat and increasing the amount of whole vegetables and fruits you eat can do wonders for your body and your energy levels.

One of the most simple and easy things I have done to improve my diet is to drink a simple green smoothie for breakfast a few times a week. I skip the bacon or sugary cereal that I used to eat in the morning and instead make a smoothie using spinach, bananas, and whatever else I have laying around that sounds good (like frozen berries). It's tasty and really fast to clean up after.

If you are overweight, the simplest thing you can do is start counting your calories. Most people underestimate how much they actually eat. They either think they are consuming less calories, or they don't notice all the little snacks they eat throughout the day. Get an app like MyFitnessPal, and start counting how many calories you actually eat. And then slowly start cutting back on those calories. You'll soon start loosing weight.

Remove Distractons

It's hard to focus when you have a lot on your mind. The best way to fix that is to remove other thoughts from your mind. You can try meditation and attempt to become more mindful that way. I tried mindful meditation, and it felt nice, but I didn't actually get a lot out of it myself. I know others who swear by meditation. Even a few minutes a day helps them concentrate.

If you are like me and meditation does not work, there are other things you can do to help free your mind of distracting thoughts. What really worked for me was writing things down. Instead of worrying about remembering something, I started using a calendar and the Reminders app on my iPhone to keep track of things I had to remember. This is especially important when trying to fall asleep. Instead of thinking about something while falling asleep, I just wrote it down and left it for the next day.

Writing things down allows me to forget about them and remove them from my mind. I know that I will be reminded about them later.

If your desk is in an open office, do not hesitate to get some noise cancelling headphones. These are great at drowning out background noise and keeping the conversations that your coworkers are having from affecting your focus. I like to play classic music while I work, mainly because songs with singing distract me. Any sort of instrumental music is great.

Also, when you wear headphones, people are less likely to try to talk to you and distract you. Honestly, I sometimes wear my headphones without even turning them on, just so I look unapproachable.

These three things may seem pretty self evident, but it's amazing how often they are ignored by software engineers and anyone else who needs to be super focused at work. Try them out and you will see a jump in your productivity levels.