DEV Community

Cover image for My three tips for maintaining fitness and a healthy lifestyle as a software developer
Ben Halpern
Ben Halpern

Posted on

My three tips for maintaining fitness and a healthy lifestyle as a software developer

We all know the benefits of physical fitness on our lives. But despite how much we know about the need to stay fit, I've found that us software developer types are often able to play forty-dimensional logical chess with ourselves in order to always find reasons to not get to the gym. The bottom line is that getting to the gym can be easier said than done when so much of our focus is wrapped up in our terminals. With this in mind, my tips are not centralized around specific routines for physical fitness. They are, instead, a few psychological games I play in order to align my interests in improving code with improving fitness while giving myself the best chance at following through with good habits.

It is about the mind, not the body

This is my best tip for getting to the gym. As a software developer who is very focused on improving my code and improving my skills within this domain, it's too easy to drop priorities like taking care of my body. If I'm trying to get to the gym because over time, my body will be better off, it is way too easy to find a reason not to go. If the focus of my exercise is to help my mind right now, I'm excited to go. The benefits of exercise on the brain are too many to list. Seriously... after I get to the gym, my code is amazing and I can stay focused without burning out. When this is my mindset, I am able to get to the gym consistently and any body benefits are a natural bonus.

Focus on the mind over the body is also a great way to make small requests about exercise during one's day. Depending on your working situation, you may or may not have freedom to sneak in a bit of light exercise without consent from someone. If your reasoning is that it is critical for your mental flow and that you'll write way better code with the freedom of going for a brisk walk mid-day or even a pre-lunch workout, this will play better than if it's just about your personal fitness.

If this, then that approach to healthy habits

The focus on mind is a great way to align professional goals with fitness goals, but creating good habits is always an uphill battle. One technique I have adopted is an If this, then that approach. That means that I use cues that would lead to bad habits and create rules where I replace them with good habits. What I mean is that if I'm feeling frustrated, in a rut, lonely, etc. I use that as a cue to do a bit of exercise. That could mean "go to the gym", "go for a walk", "do some stretching in place", or whatever is within reach at the moment. I can't beat bad habits every time, but making it a simple rule where I can catch myself and then have an answer pre-defined for the situation, it is much easier to follow through on good habits.

Podcasts and audiobooks

This is kind of a bonus tip, as I think the first two are the more important.

To build on the first point about aligning intellectual/professional goals with fitness goals, audio is a great format for learning and advancing while still getting exercise. If the weather is nice, I can get engulfed in a semi-technical audiobook like Tim Berners-Lee's account of creating the World Wide Web and I feel like I'm learning a lot while also staying fit. I fondly remember learning a lot about ReactJs when it was first coming out by popping in some podcasts while at the gym. I think it's possible to burn out on this kind of stuff, so try to let your brain step away from the code as well if possible!

I hope these tips were helpful for you. Standing desks and other office tools probably help as well, but they are not the answer by any means. In my experience, it's about finding the right mindset, acknowledging bad habits and tendencies, and aligning yourself for simpler versions of success.

This all comes after a couple years of poor attention to fitness on my part, so time will tell if I am able to keep up with this, but so far I am loving this pattern for personal fitness. I hope this finds you well.

Top comments (21)

falansari profile image

My workplace is on the third floor and I find my brain a lot more alert early in the morning when I use the stairs instead of elevator. I also made it a habit to get up every 1-1.5hrs, go to the break room and do a couple sets of push-ups and stretching exercising. Just light-weight stuff that help keep me alert throughout the day.

lindsaylee13 profile image
Lindsay Siovaila

This is such an important topic! I struggle with letting myself get sucked into a project I'm working on for hours on end and never moving more than 20 feet away from my desk. It's easy to try pushing through a code issue until I'm mentally exhausted and have gotten nowhere. It can be hard sometimes, but stepping away and moving my body always results in me feeling energized, refreshed, and ready to return my focus to what I was working on. I usually have a better perspective on what I was trying to do after stepping away for a bit, anyway.

dceddia profile image
Dave Ceddia

I really resonate with #1. I definitely get into a depressive funk when I've not exercised in a while.

I loathe actually going to a gym though - driving there, changing, being in a room with all those people, feeling self-conscious the whole time... A few years back I found the book You Are Your Own Gym and started working through the exercises in there. It's great, I can exercise whenever I want in my own basement and I don't need any fancy equipment. I still have a problem being consistent with it, but at least I will actually do it sometimes :)

reactiveintent profile image
Mvsica Donvm Dei

As a cancer survivor I now appreciate life more than ever. Even though I've been physically fit most of my life just before the cancer I was not exercising much. A friend at the time started to tell me "your body is a part of your project too". After being very sick I finally got it!

I take a lot of minute vacations but am not big on naps. Also, taking a day or a few away from the screen can work wonders and you tackle things with more vigor. I'm always wishing things could be done yesterday but life is rich and will offer you balance.

tonyhicks20 profile image
Tony Hicks

I found the same thing to be true! As a coder we tend to focus on our minds and our bodies come second. Another factor is sleep. I've had too many nights getting only 3-5 hours and then relying on energy drinks to get me through the day. It was really unhealthy and when the weekend came I could barely move. I suppose it also depends on the company culture but it's important to realise that just because others are doing it, it doesn't have to become your norm. I like to experiment with things and I don't enjoy gym so I've been trying to see it as something like good hygiene. Focus on a muscle group and train to failure - Bodyweight exercises or dumbbells. A workout takes about 15-30 minutes and doesn't have to be a big deal - getting changed, driving to gym etc. Also put a boxing bag in my study which also helps with cardio and getting rid of stress :-)

ponach profile image
rachid el kedmiri

I bet that boxing bag is helpful whenever faced with a bug !

tonyhicks20 profile image
Tony Hicks

It's the best, and saves some wear and tear on my keyboard ;-)

anthonydelgado profile image
Anthony Delgado

Just started my fitness journey .... I’m down 25 Pounds and counting ..... it’s easy to get out of shape as a dev if you’re not careful and I love your mindset approach to fitness πŸ’ͺ thanks for sharing πŸ™

africzkyninja profile image

Good tips. Another mental game I play is convincing myself that if I go to train early in the morning, before work. I've already conquered the toughest metal challenge of the day. So I can tackle my dev problems with a clear mind.

dondenoncourt profile image
Don Denoncourt

Yes. Yes. I've been working out during most of my lunches for my 30+ years as a coder. I prefer cycling, but I hit the gym for weights two days a week. I do the tech podcast thing as well. My lunch workout really clears my mind. I would never give it up.

anbrandt profile image
Andrzej Brandt

i would argue that although physical activity is super important, the healthy habits in your workplace are as important, if not more.

I see a lot of guys exercising a lot every day, yet in front of the computer thay don't care at all about position, about back, hands and legs. In few years time, even if you are fit, you will get problems with knees and back.

Thats why i strongly recommend standing desks. Oh my, they are so good. First timers may see it difficult and painful for the first week, but after that it is just much better, and work is much more efficient

ajpen profile image
Anfernee Jervis

Agreed. I played basketball while working 8 hours a day at my desk and the back pain was ridiculous! All from poor posture and terrible ergonomics at work.

walker profile image
Walker Harrison

Totally agree that one's intellectual and professional effectiveness is tied to physical exercise. I've found a few things about working out that help me. 1) it relaxes me and allows me to focus on what's truly important in a task and 2) it actually boosts my energy and often gives me a second wind -- the two or three hours after working out are often ones that would otherwise be a tired/sluggish time for me.

andrewdtanner profile image
Andrew Tanner πŸ‡ͺπŸ‡Ί

I started swimming a few times a week about 3 or 4 months ago and I'm really happy and surprised at my progress! I've gone from barely scraping 10-15 lengths to doing 70+ in well under an hour with bags of energy to spare. It's great to unwind with swimming, the repetitive motion means I can focus my mind on other things (aside from counting lengths, of course) and sometimes that stuff might be work related or might not. A while ago I left work with a big nasty headache that I'd had all day, I was reluctant to go swimming but in the end I decided to and after half an hour in the pool my headache had lifted and my mood with it. I needed to get my head out of the computer, literally and figuratively and it was perfect.

I'm also walking to and from work most days which is around 5 miles, I use this time to squeeze in the odd podcast or just enjoy some music and set myself up for the day. I ditched the car back in the summer to improve my fitness but walking also helps wake me up for the day ahead.

Oh and thanks Ben for linking to the Tim Berners-Lee book. I'm definitely going to check that out.

candidodmv profile image
Vinicius Dutra

I think this is the most common problem that almost all IT professional experimented or will experiment. As your text said, this is not not a question of beauty, but health. The bonus of this habit is a gift! Congrats for this interesting text.

jorgeguberte profile image
Jorge Guberte

I started practicing Qigong almost daily, and the benefits are incredible. My entire body is better, and my concentration got better as well.
Now I'm feeling the need to do something more intense, like weightlifting or jogging.

danieljsummers profile image
Daniel J. Summers

There's a free book on Kindle called Never Binge Again - it's about recognizing your body's negative desires as negative, and therefore counter-productive to your goals. I don't know that I buy everything in there wholesale, but the concept has helped me to identify impulses I have (usually to eat something calorie-laden) as something that's sabotaging my health goals.

andy profile image
Andy Zhao (he/him)

if I'm feeling frustrated, in a rut, lonely, etc. I use that as a cue to do a bit of exercise.

Definitely agree with the whole "replace bad habits with good ones." I also noticed with myself that if I go immediately (less than 5 seconds) and don't give my brain any time to talk me out of not doing exercise, I always end up exercising.