Taking Care of Your Mental Health as a Software Developer 🧠

Alex Hyett - May 14 '23 - - Dev Community

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 →

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .