DEV Community

Cover image for Taking Care of Your Mental Health as a Software Developer 🧠
Alex Hyett
Alex Hyett

Posted on • Originally published at

Taking Care of Your Mental Health as a Software Developer 🧠

Next week is Mental Health Awareness Week, so I thought I would take this opportunity to talk about our mental health.

Software development is mostly dominated by men and as you know we aren't particularly good at talking about our feelings. Combine this with high-stress environments and a general lack of social connectivity in our work, you end up with a pressure cooker for mental disorders.

When trying to describe programming to my non-technical friends and family, I often use the analogy of solving sudoku.

Imagine trying to solve a sudoku puzzle, except you aren't allowed to use a pen and everything has to be done in your head. Now try doing this for 8 hours a day and you get a good idea of how mentally taxing programming is.

This is why developers need large blocks of uninterrupted time to code, most of the work is done in our heads.

Therefore, keeping our minds healthy is critical for us to be effective at work. Some of the advice for maintaining a healthy mind include:

  • Staying active
  • Reducing screen time
  • Getting plenty of sleep

Software developers, however, generally fall short of all three of those ideals.

A software developer's job is spent sitting at a computer and staring at a screen. Even when we are at home there is a chance you might be on-call, which will require you to jump on your computer at a moment's notice to solve a production issue.

If you have been on call before you will know that even if you aren't called, your sleep will likely suffer anyway.

Every year mental health is becoming more of an issue for software developers. If we take a look at the Stack Overflow Developer Survey for the last 5 years we can see how things are deteriorating.

Each year the survey asks developers to specify if they have one of the following:

  • I have a concentration and/or memory disorder (e.g., ADHD, etc.)
  • I have an anxiety disorder
  • I have a mood or emotional disorder (e.g., depression, bipolar disorder, etc.)

If we look at how the results for these have changed over the past 5 years you can see a worrying trend.

Stack Overflow Mental Health Results

With the exception of 2020, there has been an increase year on year. Although it should be noted that there were around 6,000 fewer responses in the 2020 survey for this question compared to other years. The survey was also conducted in February 2020 before COVID-19 was declared a global pandemic, so this isn't the cause.

The survey for 2023 is now live, it will be interesting to see how this has changed. With the amount of layoffs we have seen recently in the tech industry, I doubt anxiety is going to be any lower.

Being a software developer can be overwhelming. Not only are we expected to perform mental gymnastics on a daily basis but we also need to stay ahead of the new technologies so that we don't fall behind.

πŸ‹οΈβ€β™€οΈ Mental Health Exercises

I have suffered from burnout before but I have managed to come up with my own ways of dealing with it which will hopefully help.

βœ… Check in with yourself

We aren't great at talking about our feelings however in most cases this isn't from emotional shyness. We actually don't know how we feel.

Like the frog in boiling water, feelings can gradually increase over time without us thinking, "Is it me or is it getting hot in here?".

It is worth taking some time to write down how you are feeling, whether it be stressed, tired, overwhelmed or depressed. Or all of the above.

Identifying your feelings is the first step in actually doing something about them.

When someone asks, "How are you doing?", we often reply "Not too bad!". I think you can do a bit better than that when you ask yourself the same thing.

🚢Walk, a lot

My aim for most days is to walk at least an hour a day.

The first half an hour is usually me going over my thoughts and thinking about all the things I need to do. The last half is where I get the most benefit, a clear head and a general sense of calm.

It doesn't have to be walking but an hour of exercise a day will do wonders for your mood and your health in general.

We spend so much of our working lives sitting and staring at a computer that it is important to get away from that when we are not working.

When I used to work in London, in the summer, I would often get some lunch and walk from Oxford Street up to Regents Park. I would sit on the grass, eat my lunch and then wander around the gardens before going back down to the office.

Taking a walk at lunch was the best way for me to evade the afternoon slump that we often experience.

🏑 WFH Daily Routine

When we work from home, the line between our personal and professional lives can blur. Always being connected to our work is not healthy and can be the cause of a lot of anxiety and stress.

The best way I have found to create a clear distinction between work and home is to have a separate work phone. I was never issued with an official work phone I just used an old iPhone that I had laying around. At the end of the day, I would switch the phone off (provided I wasn't on call) and avoid that temptation just to check in on things.

You should also try and have a set time each day that you finish work. I like to eat dinner with my family every night so I must finish at a reasonable time. I would work from 8 am to 5 pm each day and I got into the habit of declining any late meetings that weren't essential.

I find trying to work after 5 pm futile anyway. I do my best work in the morning and then struggle to do anything creative (including programming) in the afternoon.

Things come up and it isn't always possible to adhere to such a strict schedule but you should try your best. I find setting the working hours in Google Calendar is a good way to send a subtle message to colleagues who try and book a late meeting.

If you struggle to switch off after working from home I find going for a short walk helps. You are essentially simulating your commute home and it provides enough distinction to get out of your head so you can enjoy your evening.

Try and keep screen time to a minimum in the evenings, especially if you have spent all day staring at a screen. I like playing video games but I save those for the weekends when I haven't been on my computer all day. During the week I tend to play the guitar, read or draw.

I have also removed all social media apps on my phone. I find TikTok and Instagram reels especially dangerous, having wasted hours mindlessly scrolling through cat videos and people being stupid.

Try and find a hobby that doesn't involve basking in the light from an electronic device.

β˜•οΈ Schedule Coffee Breaks

Humans are social creatures even if you are an introvert like myself. It is important to make time during the week to talk to your colleagues.

It has been shown that loneliness and isolation can lead to several mental health conditions so make time to talk to others.

If you or your colleagues work from home regularly, schedule a Zoom call each week for half an hour, just to talk. Work topics should be banned in these meetings and you should take it as an opportunity to get to know your colleagues.

If you are in the office and you have a coffee shop nearby then why not have a sit-down coffee instead?

I used to work around the corner from a Kaffeine and myself and a few others would regularly go there at the start of the day just to have a chat. It was one of my favourite things about working in London.

πŸ™ Find Meaning in Your Work

At some point, most of us ask ourselves "What is the point?".

I found myself asking this question a lot when I worked in finance. The whole purpose of the business was to make money or help others make money. There are no true altruistic goals with anything in finance.

This can often cause depression by itself. Most people spend 80,000 hours in their careers so you don't want that time spent to be meaningless.

One option is to find a career that has a positive impact. At least on the bad days you know it is all for a good cause. The 80,000 hours project is one place to start if you are looking for a career where you can make a difference.

If you are not in a position for a career change, then there are ways to find meaning in an otherwise meaningless job.

Look to your colleagues and see if there is something you could do to help them. Is there a junior software engineer that you could take under your wing and mentor?

Did you learn something that you could share with others?

πŸ›‹οΈ Finding Help

If you are still struggling it is important that you find some help.

This doesn't necessarily mean going to a shrink, there are ways you can help yourself.

I have personally found mental health podcasts especially good for this. Knowing that you aren't the only person experiencing something can help dispel that feeling of loneliness.

I have enjoyed listening to:

  • Happy Place by Fearne Cotton - If you grew up in the UK watching Top of the Pops or listening to Radio 1, then you will know who Fearne Cotton is. These days she works on her podcast interviewing people about mental health, as well as writing several self-help books.
  • On Purpose with Jay Shetty - This isn't directly a mental health podcast but features interviews with the likes of Ryan Holiday, Ray Dalio and Yuval Harari to name a few. The topics however often steer towards mental health and self-improvement.

If you have private health care included with your employment, mental health support is often available. There are also free helplines around the world that you can also use.

❀️ Picks of the Week

πŸ“š Book - Armada by Ernest Cline (affiliate link). I am currently reading this book written by the author who wrote Ready Player One. If you liked the geeky video game references from that film then you are bound to like this as well. The premise of the book is, "What if video games were military training simulators to train civilians in preparation for an alien invasion?". I am only halfway through at the moment and feels like it is leading up to a big twist at the end.

πŸ“ Article - Do the weirdest thing that feels right. I often struggle with what to write about. Believe it or not, sometimes I don't feel like writing about software development. This article has a great philosophy that I need to take heed of more often.

πŸ“ Article - Introducing 100K Context Windows. Claude AI has now reached a 100K context window. Soon AI will be able to consume whole books or codebases.

πŸ§ͺ Experiment - See this page fetch itself, byte by byte, over TLS. Learn about TLS by seeing how a page is downloaded.

πŸ“ Article - Datadog’s $65M/year customer mystery solved. Interesting insights into Coinbase's spending on Datadog. Datadog is a very good product but I am not sure I would be happy with that level of spending!

πŸ‘¨β€πŸ’»Β Latest from me

🎬 YouTube - In order to understand recursion... There are a lot so jokes about recursion that don't do a very good job of explaining what recursion is used for. In this week's video, I explain recursion using the help of one of my favourite films, Inception.

πŸ’¬ Quote of the Week

"If you're the smartest person in the room, you're in the wrong room" - Richard Tirendi

From 6 Months to 6 Figures (affiliate link) by Peter Voogd. Resurfaced with Readwise.

πŸ“¨ Are you looking to level up your skills in the tech industry?

My weekly newsletter is written for engineers like you, providing you with the tools you need to excel in your career. Join here for free β†’

Top comments (18)

ant_f_dev profile image
Anthony Fung

Great write-up, Alex.

I'd also agree that taking a break from your desk for lunch is essential. For a short time, I used to work near a chapel where they'd have free music recitals once a week. Some were better than others, but it was nice to just disconnect from work for a while.

At other places I've worked, I would often just walk around the block, or go with friends to the shops where they'd buy their lunch (even though I already had my own).

alexhyettdev profile image
Alex Hyett

That sounds like a great way to spend your lunch break.

One of the worst places I worked was in a big office building in the middle of nowhere off of a busy main road. I used to walk around the building as it was the only option.

ant_f_dev profile image
Anthony Fung

I know what you mean - you end up not know if the walk is actually doing you worse from inhaling fumes from lots of traffic.

Another thing I forgot to mention for mental health is slow/deep breathing exercises - they can help to build up resilience against stress too.

nite_dev profile image
Sheriff S

Hi Alex! I came across your article on taking care of mental health as a software developer, and I have to say it's one of the best resources I've found on this topic. Your insights and tips are incredibly valuable, and I appreciate the emphasis you've placed on self-care and well-being in a demanding field like software development. Your article resonated with me deeply, and it's refreshing to see someone addressing the importance of mental health in our industry. Thank you for shedding light on this crucial aspect and providing practical strategies to maintain a healthy work-life balance. Your content truly makes a positive impact on aspiring developers like me. Keep up the great work, and I look forward to reading more of your insightful articles!

buchslava profile image
Vyacheslav Chub

Alex, thank you for your article. This topic is super important because developers with mental health issues could cause software with software health issues (it's more than bugs, btw). I mean hidden logical mistakes and messy ideas implementation.

Let me add one additional factor that involves developers' mental health drastically. The fact that every software is a child of two parents. The first is a team of developers or a developer, and the second is a customer. That's why I'm so skeptical regarding the paradigm when the customer looks like a spectator. Moreover, if the customer neglects the developer's work when the customer doesn't want to collaborate with the developers' team, then it also causes the developer's mental health.

As a result, an exhausted developer will:

  • Staying inactive
  • Increasing screen time
  • Has issues with sleeping
fractalis profile image
Scott Rallya

Fantastic advice, and absolutely true. The consequences of not taking care of your mental health can be severe. I encourage everyone to have a proper mental health care regiment. Activities like writing, mindfulness meditation, creative pursuits like drawing, listening to music, exercise, and healthy eating are all great ways of improving and enhancing one's overall mental health. Ask if your company has a mental health day policy, and if you need one, don't be afraid to ask to take a day off to recover and recuperate. Neglecting one's mental health can have long term consequences, and recovering from poor mental health can be a long and slow process. Never take your mental health for granted.

alexhyettdev profile image
Alex Hyett

Yes that is very good point about the mental health day policies. Although sometimes a day is not enough!

jwilliams profile image
Jessica williams

Very nice article Alex,

Taking care of your mental health as a software developer is essential for maintaining overall well-being and ensuring long-term success in your career.

Finally someone thought of this as well, keep write article like this.

God Bless You!

alexhyettdev profile image
Alex Hyett

Thank you Jessica!

isolderea profile image

Really nice article.
Will try to follow along with some of the suggested actions.
I also try to watch and post some videos to help with my menthal health

alchemylab profile image
Luigi Pesce

Great post, indeed, thanks for sharing
I agree that "walk" is one of the best actions to stay healthy during the day.
I also follow the "pomodoro technique", taking pauses every 25 minutes; it helps me to stay focused and lower the pressure

nsoul9 profile image

Great Alex, thank you for your words

pookiepats profile image

Walking and stretching, so simply and effective; 1 hour a day has turned my energy levels around!

alexhyettdev profile image
Alex Hyett

That's awesome. I definitely need to do more stretching. Especially now that I am the wrong side of 30.

pookiepats profile image

lol mannn i'm right behind you.

anja profile image

Awesome read! Also the quote do the weirdest thing that feels right is inspiring πŸ’‘πŸ˜Š

karaca19 profile image
Bora Karaca

Really enjoyed reading this. It's really important to give your mind and body a rest after sitting in front of a screen for so long. Exercise does this for me.

beingoptimists profile image

Thank you for your information