How to Stay Healthy as a Programmer

Health and fitness are not the most interesting topics for someone looking for programming tips and code examples, but nevertheless we have to keep our body and mind in check if we want to stay sharp and productive. Because besides adding years to our life, healthy habits also let us have more energy and focus and be less distracted by problems that arise from a devastated body.

But as for most things in life, you have to be consistent with these healthy practices in order to get results. If you go hard on exercise and diet for a month but then fall back to guzzling energy drinks and sitting around all day, you get very little benefits. That’s why we won’t only talk about what you should do in order to stay healthy, but how you can implement these things without having to turn your whole schedule upside down. It’s really not as hard as you might think.

So if you didn’t just click on this post by accident, let’s take a look at some healthy habits that you can easily implement into your own lifestyle.

 

Fix your posture

Pain caused by bad posture is one of the biggest and most common problems for computer workers, because the longer you sit in front of a PC, the less you tend to pay attention to how you sit there. Misalignments like a rounded back or wrong head and neck positioning can sneak their way into your body the more hours pass and cause longterm health problems and chronic pain. And as programmers who enjoy coding in a state of flow, we can sit there like this for long periods at a time.

The foundation for a proper posture is a good chair. That doesn’t mean it has to be expensive. This one here from Amazon has great ratings and only costs around 60 bucks. A good chair should be formed in a way that supports your lower back and have an adjustable height.

When it comes to the posture itself, the following image explains it better than I possibly could:

Let’s be real here, no one’s gonna sit like that for hours on end. I certainly don’t. But at least try to pay attention to your posture from time to time and adjust it a bit. After a while you will make sitting properly a habit and can keep it up without having to actively focus on it. Later in the post we will talk about taking short breaks and standing up from your desk regularly, and this is also a good opportunity to get back to work with a corrected posture.

Also try to keep all the things and gadgets you need close to you, so you can reach them without having to bend yourself. For us developers that might be programming books or testing devices.

If you’ve read my other posts, you know that I often recommend this trackball mouse, because it helped me fix my shoulder and wrist pain to a big extend. Without it, I couldn’t work on a PC anymore. If you feel like your arm or shoulder hurts often, give it a try.

An ergonomic keyboard can further help you prevent strain on your shoulders, arms and fingers. However, I still use a normal keyboard myself.

 

Get some exercise and eat properly

Just sitting straight is not enough. In order to stay healthy, you also have to train your body regularly. But you don’t have to do it to an extreme level.

One of the biggest misconceptions (or excuses) people have about exercise, is that it would take too much time. It doesn’t, people just stretch it out unnecessarily.

Take running for example, which is a very effective form or aerobic exercise that you can do without any equipment. Of course you have to do it for 40 minutes before you even start feeling exhausted, if you jog slowly on a flat street. But that’s just a relaxing stroll while enjoying a nice view. If you really don’t have much time, why not sprint a hill up and down for 10 minutes instead? This will get you exhausted. It will also leave you without any excuses. Do this after waking up, before taking a shower, and it will not even leave a dent in your schedule. But it will strengthen your cardiovascular system, muscles, joints and bones, it will lighten your mood, prevent depression and make you feel more energetic. A run early in the day also makes sure that you get some sunlight exposure and at night it will let you sleep like a baby.

Besides keeping you healthy, running and other forms of exercise will also make you smarter and improve your memory by increasing the blood flow through your brain, supplying it with more oxygen. Studies like this one further show a link between exercise and improved brain structure, for example as increased volume of the hippocampus (which is associated with learning, memory and decision-making). If you don’t exercise, this part of your brain shrinks with age and can cause late-age depression and Alzheimer’s disease. In short: Exercising keeps your brain young.

If you also want to improve your posture and get stronger (and better looking), add a weightlifting routine to your weekly schedule. Again this doesn’t require a huge time investment.  People think that you have to lift 3 hours per day, at least 5 times a week and only eat boring food all day to get big and strong, but that’s not the case at all.

If you are efficient about it and base your workout on compound lifts like squats and deadlifts (which you should do anyways), you can get in great shape with a time investment of about 1 hour per workout and 3 workouts a week. That’s 3 hours per week plus the time you need to get to the gym and back. Heck, you could probably even get away with 2 workouts a week and still make good progress, but I’ve never tested it. I went to the gym 5 times a week for a while, but I have stuck with 3 times a week for the last ~2 years now, because I realized that it’s the best tradeoff between time investment and progress. Additional days can make you bigger faster, but that’s not the point here. We want to be efficient about it and add it to a well rounded lifestyle. It’s all about the Pareto principle.

I have not only tested different training frequencies, but also different diets. I ate super “clean” for 2 years, only consuming stuff like oats, veggies, chicken, nuts and water. It’s was terribly plain and boring, but I stuck with it because I thought it was important to get muscular. Later I have also tested eating “if it fits your macros”-style, where I basically ate whatever I wanted, including a lot of sweets and fast food, but counted my calories and macronutrients (carbohydrates, protein and fat) with MyFitnessPal. I literally had cake for breakfast for months in a row.

Ironically I got chubby when I ate clean and stayed lean while eating cake and fast food. Why? Because I ate too many calories when I ate oats and nuts. I miscalculated my body’s energy consumption. Because when it comes to body composition and how much muscle mass you build and how much fat you gain while doing weightlifting (or any other sport), calories and protein are what matters most. Period. You can build a great body while eating fast food all day, if you are willing to count calories and don’t overshoot. Will that keep you healthy? Hell no! But the point here is that you don’t have to eat boring stuff like chicken and rice all day to stay (and look) fit. The only reason people who eat a lot of fast food tend to get fat, is because it has a high calorie density. It is much harder to stay sated with fast food and sweets than with oats and chicken. They simply consume more calories.

If you want to be fit while still enjoying food, try to get most of your calories from healthy sources like whole grains, nuts and fish, eat a lot of vegetables, but also allow yourself a burger or pizza when you feel like it. It’s all about moderation. Drink a lot of water or unsweetened tea and avoid soda, fruit juices (no, they aren’t healthy) and alcohol. If you are serious about building muscle, I would strongly recommend using MyFitnessPal to track your food and this way make sure that you eat the right amount of calories and protein. Those are the 2 numbers that matter most when it comes to body composition and looks. It’s not that hard, but it will help you immensely, because both eating too many but also eating too little calories will impair your physique. The former will let you add unnecessary fat, the latter will not let you gain any more muscle mass, just like too little protein.

I’ve once cut down from way over 20% body fat to 10%, losing around 15 kg of fat along the way. It was extremely easy, yet lots of people in my gym came to me and asked for my secret. The “secret” was counting calories and macros. Knowing exactly how much I could eat made shredding a cakewalk.

The bottom line of this paragraph is: keep it simple. Train regularly with short, intensive routines and track your food. Eat a lot of vegetables and try to avoid stuff that you know is unhealthy as often as you can. This will give you amazing results.

 

Sleep enough (and sleep well)

I’ve read a lot of books that directly or indirectly talk about the importance of sleep and the negative effects of getting too little of it. Studies have shown again and again that sleep deprivation causes you too be less efficient and make worse decisions and more mistakes. It lowers your ability to concentrate and negatively impacts your short- and long-term memory as well as your creativity and problem-solving skills. The 1 or 2 hours you “win” by sleeping less are greatly outweighed by the negative side effects on your mind and body.

Besides reduced performance and lack of focus, too little sleep also causes health problems like high blood pressure, heart disease, obesity and even diabetes. It weakens your immune system and increases the risk of injury and accidents. One sleepless night makes you grumpy, a lot of sleepless nights can make you depressed. Lack of sleep really is a super weapon when it comes to destroying your body, so better make hitting the pillow a priority.

But how much sleep do you really need? There are different opinions on that and it also depends a bit on your genetics. According to science there is a very small group of so called “short sleepers” that can get by with 5 hours or even less (longterm), and still be fit and healthy. But since this is like 1% of the population, chances are you don’t belong to that group (A good hint is how much sleep your family members need). For us mortals something in the range of 7-8 hours per night is probably perfect. But attention! You might think that you “trained yourself” to sleep very little, because you can pull that off and still feel good. But the fact that you trained yourself to not feel like a wreck, doesn’t mean you perform at your best.

Not getting enough sleep is – like most other things on this list – most often not about having to little time, but about bad time management. I can say from my own experience, that sleep procrastination (when you know you should go to bed but still spend time aimlessly surfing the web or doing some other unnecessary stuff) is a pretty big deal. But there are some ways to cope with it. Set yourself a fixed time for when you have to go to bed and then stick to it. If you keep exceeding it, set an alarm, just like you have an alarm for waking up. Get ready for bed early enough, so you only have to turn off the lights when it’s time to sleep and don’t need another 30 minutes to do your nightly routine.

Also consider installing the free tool “f.lux”, which filters out the blue light from your computer screen later in the day to mimic natural sunlight and this way make you more sleepy. Iphones and Android devices have this feature implemented by default nowadays. And as I already mentioned earlier, doing exercise early in the day helps you get more sleepy at night. If you train too late, your body is still heated up and pumped when you hit the pillow.

But just as important as the amount of sleep you get per night is the quality of it, because you don’t really win much by sleeping badly for 9 hours. A very good book with a lot of helpful tips on this topic is “Sleep Smarter” by Shawn Stevenson.

There are a lot of things that play a role in your sleep quality, like bedroom temperature, the type of pillow you use or at what time you go to bed. One particular point I want to mention here is caffeine. We all know that it’s probably not a good idea to drink coffee right before bed, but did you know that even consuming caffeine 6 hours before going to sleep can significantly lower your sleep quality? A study at the Henry Ford Hospital Sleep Disorders & Research Center in Detroit has shown this. Now you might say “I’ve drunk coffee before bed countless time and I still sleep like a baby!”. But the truth is, you don’t. The catch is that the participants in the study didn’t notice their diminished sleep quality, because their perception was tricking them. They thought they slept like a baby, but the depth of their sleep was lowered significantly, causing them to wake up more often and spending less time actually sleeping. This means you might rest 8 hours, but only get the equivalent of 6 to 7 hours of sleep. That’s not every efficient.

Be mindful about your caffeine consumption and try to drink your last coffee about 8 hours before going to bed. The same of course goes for other caffeinated beverages, like tea or energy drinks.

 

Take regular breaks

Even if your posture and equipment is perfect and you already exercise regularly, you should still stand up from your desk from time to time to move around and stretch a bit. This way you avoid keeping your body in the same position for long periods of time, you give your eyes some rest from focusing on the screen and your joints and tendons can relax a bit from the repetitive movements. Also it gets your blood flowing and your heart rate up, which is good for your cardiovascular system and burns some extra calories. Sitting for hours on end every day is actually really unhealthy and has negative side effects similar to the ones of sleep deprivation, including diabetes and cardiovascular disease. This has been shown by studies like this one. But you can counter it simply by standing up from your desk and moving around from time to time.

You might even want to switch to a standing desk to avoid the side effects of sitting. I’ve never tested one, but I know that a lot of people swear on it. When I move to a new apartment, I will probably buy one myself.

But not only are regular breaks healthy for your body, they also help you solving difficult problems by letting your subconscious mind work them in the background, leading to “Aha! moments”. I’ve written about that topic in a bit more detail in this post.

Try to take a short break every hour or so. However, I wouldn’t set a timer for it. If you are in a state of flow, you don’t want to get interrupted. Just make sure that if you take a break, you actually stand up and move around instead of spending it scrolling through Facebook. Also avoid eating at your desk.

When it comes to breaks in terms of taking whole days off from programming, I don’t think you have to plan this. Of course there will be situations where time away from the computer is convenient, like trips with your family or special events, but I would go with these occasions instead of setting a fixed off-day each week. My approach is to always try to work and learn at least a little bit on any given day, even if it’s just for half an hour. It’s just so much more effective than cramming.

 

 

You see, exercise and healthy habits are not just about looking better and running faster. They literally safe you from dying an early death and becoming dumber and less performing with every year of your life. So try to implement some of these techniques if you haven’t yet and start building more good habits.

Do you have any other tips on how to keep our body and brain in shape? Share them in the comments below!

6 thoughts on “How to Stay Healthy as a Programmer”

  1. 1.) Vitamin Water Everyday- Super important B Vitamins. Stop Energy drinks.
    2.) Eye Strain – Code your own timer to allow 20 seconds at 20 minutes intervals of >20 feet distance of eye focus ‘rest’. Wear Gunners, adjust to a warmer monitor color, and use ‘dark’ IDE themes. Trade contacts for glasses.
    3.) Posture – Don’t just sit up straight. Have a standing desk that you use for run time testing. You’ll be standing up and down all day giving you the exercise you need.
    4.) Beer. Sounds funny? Not according to research. Apparently 1 beer BEFORE your coffee/caffeine is an extremely effective way to put your brain into a perfect state of mind.

Comments are closed.