Physical and Mental health tips for coding

Photo by Christina @ on Unsplash

Physical and Mental health tips for coding

Andy Milne's photo
Andy Milne
ยทJan 3, 2022ยท

6 min read

If you sit at a desk all day and stare at a computer screen(s), taking the occasional coffee, snack, or lunch break, you may be causing long term harm to your body and mind.

For over 10 years, I spent my working day sitting hunched over my desk, staring at multiple screens, drinking way too much coffee, only to go home and do the same thing. At the time I didn't seem to think it was a problem, but over time, I started developing several health issues. All that time staring at screens was causing problems with my eyesight. All that time sitting at my desk as if I was lounging was causing posture issues, which began to affect my back, my legs, and my chest.


All that coffee was causing sleep problems, something I had trouble with before I started my career, and only made things worse.

So I learned a couple of tricks to help with all of the above, that I hope may help you and prevent any of the physical and mental problems mentioned above.

Take a short break every hour

Doctors recommend taking a short break from your screens every hour. Set a reminder on your phone, and make sure you take a break, don't just snooze it (unless you're in a meeting or on a call - just make sure you take a break before and after the meeting or call). These regular breaks will help rest your eyes, and can help with productivity. If you've ever had a problem that you spent hours trying to fix, only to solve it after leaving it for 5 minutes, you'll know that a short break can help the solution appear in your mind.

Keep hydrated

During your hourly break, get up from your desk, go grab a small glass of water (250ml), and drink it before you return to your desk. If you simply can't function without a hot drink (tea, coffee, latte, hot chocolate, mulled wine, flaming sambuca), take one to your desk along with another glass of water. Caffeine can cause dehydration, so ensure you counter the effects with more water. Of course, the downside is you may be using the restroom more often than before, and drinking too much of any liquid can cause other issues, so make sure to stop drinking if you aren't thirsty.

Standing Stretches

While waiting for the kettle to boil, do some simple stretches to help your posture. Place your feet shoulder width apart, put your hands on your hips, and gently arch your back forwards for 10 seconds, then backwards for 10 seconds. Repeat 3 times. This will help reduce problems with your back caused by sitting at your desk like Igor.

While keeping that stance, slowly tilt your head up so you're looking at the ceiling, hold for 10 seconds, then slowly tilt your head down so you're looking at the floor, hold for 10 seconds, and repeat 3 times. This will reduce the strain on your neck.

Sitting Stretches

You can also do some simple stretches while sitting at your desk. Sit upright and slowly lift your left leg so it's straight. Hold for 10 seconds. Slowly lower your leg, and repeat with the right leg, again for 10 seconds. Repeat 3 times.

Hold your arms straight in front of you, interlinking your fingers, with your palms facing away from you. Slowly lift your arms over your head and stretch, holding for 10 seconds. Slowly lower them, unlinking your fingers, then open your arms, stretching as far back as you can, so you resemble a T, holding your arms there for 10 seconds, then return them straight in front of you, interlinking them again. Repeat 3 times.

Stretch and Breathe

Breathing exercises can also help, not just with stretching, but can help destress and calm you down. This not only helps with problem solving, but can help with sleep too. Slowly inhale through your nose over 10 seconds. Hold it for a further 10 seconds, but if you're struggling, 5 seconds is fine. Then slowly exhale through your mouth over 10 seconds. Rest for 5 seconds, and repeat 10 times.

When you're stretching, make sure you inhale through your nose and exhale through your mouth. Inhale at the start of the move, and exhale at the end. This helps get oxygen to your muscles before you use them, allowing them to function better.

Do While Not Exerted

Do these stretches 3-5 times a day. Do not over do it, as it can cause harm to your muscles if they don't get enough rest. If you already have an exercise regime, you can incorporate these stretches into your daily routine, but please make sure you don't do too much. The information and advice I've given aims to help you, and the last thing I want is for you to try to do too much and cause more harm than good.

9-5 means 9-5

We all love our devices. We love creating awesome products, apps, websites, games, etc. But we need to make sure we don't spend every waking moment at the computer. Staying up all night to code is all fun and games until you start neglecting sleep, or spend so much time glued to gadgets it puts too much strain on your eyes. Make sure you get at least 8 hours of sleep, but switch off from gadgets and devices at least 1 hour before you go to bed. It's perfectly reasonable to want to do more work when your job finishes, but doing too much all the time will cause more problems for your physical and mental health.

Trying to do too much too often can cause burn out. It's a career killer and can even cause depression and anxiety. While coding is a passion and a hobby, make sure you have time for other passions and hobbies that take you away from your computer.

Photography is a great hobby to get into. Go for a walk and use your phone's camera to take pictures of animals, trees, the sky, a lake, anything - just not people or their property without their consent. This not only has the benefit of walking as exercise, but also allows you to focus on something away from coding and can actually help boost your creativity by making you look for interesting and awe inspiring scenes to capture. And best of all, if you already have a smartphone, you don't need to invest in a camera, unless you really get into it. Side note, I don't do photography, I spend my free time trying to stop my children from fighting ๐Ÿ™ƒ

I'm not a Doctor

These are just some of the steps you can take to improve your physical and mental health, but there is so much more you can do to help. I am a website developer, not a doctor, I am simply imparting advice given to me by doctors, physiotherapists, chiropractors, and opticians. Before making any changes to your lifestyle, please consult your doctor.

Share this