5 Tips to Not Rip Your Hair Out When You're Can't Figure Out a Bug

Every developer gets seriously stuck on something at some point.

This last weekend I was working on an integration with a new API and I spent over 2 days just trying to get authentication working between services. I was about to throw my computer off a bridge and pursue a new career entirely.

It reminded me of the most difficult thing software engineers deal with and the unspoken skill you need to become an expert in to succeed... managing your mental health.

Managing Your Mental Health as a Software Engineer

Here's how to manage your mental health when you hit your limit.

1. Take a Break

When I can't solve a problem or figure out what's causing a bug, I don't give up.

How to Learn AWS
How to Learn AWS
Learn AWS the easy way, become a leader on your team.
How to Learn AWS

I can spend hours digging into everything that might be causing it, but still not make any progress. From experience though, this is not the most efficient way to solve a problem.

This morning I woke up well-resting with a fresh mind. I managed to fix that API issue I spent 2 days on in no more than 20 minutes.

This is usually how it goes.

Most problems we run into are caused by incredibly small issues.

Forgot a semi-colon. Didn't capitalize a letter. Didn't read the documentation correctly.

If you are spending multiple hours trying to figure out an issue, whether you like it or not you are mentally exhausting yourself and emotions are probably getting to you.

You are not in the best state of mind to identify the little issues that are actually causing your problem.

The best way to save your mental health and more effectively tackle these issues is to reset your state of mind. Just take a break for a while.

Sleep on it, and when you come back to it later it'll be easy.

2. Recognize Most Problems Require Simple Solutions

I sort of alluded to this above, but as software developers, we face what we think are difficult problems.

But 90% of the time the fix is embarrassingly tiny.

We get stuck on problems and quickly scan vast amounts of code. We can't identify the issue immediately so we start to overthink it. While we're thinking of all of the high-level reasons why a thing isn't working, it's impossible to pay attention to the little things.

Recognize that most of the time, bugs are caused by little things.

Check your syntax, capitalization, and at least try to skim through the documentation before using a new tool.

Don't stress out about not being able to fix an issue, and keep in mind it's probably going to be a tiny one-line (if not one character) fix.

This should help you contain your emotions and work with a more stable mental state. Don't underestimate the impact of bug hunting and difficult errors on your mental health.

3. Ask For Help

If we can't take a break, we can get a similar effect by leveraging our team.

Odds are if you ask a teammate for help, they can approach the problem with a fresh set of eyes and might be less likely to overlook the small details causing the issue.

Now I totally admit, asking for help is hard sometimes.

Whether you think it makes you look less capable or if it triggers your impostor syndrome, it's a skill on its own that will pay you dividends throughout your career.

And this is the perfect time to ask for help.

Instead of endlessly struggling with a problem and letting it take a toll on your mental health, enlist the help of a teammate.

And for those of you who work independently or don't have teammates, take advantage of the internet! There are online communities all over the place that will gladly help you identify and solve your problem.

4. Think About Remote Work

Recently, a lot of companies have gone remote.

Software development is one of the easiest jobs that you can pursue if you want to work remotely. And if you find office culture challenging and stressful, a remote working lifestyle might introduce more freedom and peace in your day-to-day.

You might want to consider switching to a remote role or asking your current company about the option. You probably have a good chance at making it a possibility if you can argue its relevance to your mental health and overall happiness and productivity.

On the contrary, if you work remotely and find it difficult for your mental health you can try going back to the office.

The office will surround you with peers who will be there to help you and support you. Instead of your mental health issues going unnoticed in a remote work environment, in the office, there are people around you every day to help you succeed.

Think about your current work environment and whether or not a change might positively impact your productivity and mental health.

5. Take Time Off

Most importantly, take time off.

Make sure to use your vacation time. It's intended to help you avoid burnout. People aren't meant to work in front of a computer for the majority of every single day, so use your vacation days and reset your mental state.

A lot of companies offer "unlimited PTO" nowadays too. This is awesome, in theory, but in a few ways benefits the company more than you. For example, when you leave the company you won't be compensated for vacation days you didn't use.

It also means you have to be more proactive about taking time off.

When you aren't counting how many days you've taken off, you will probably end up not taking as many as you should. It's up to you to take advantage of this policy and take the time you need to manage your mental health.

Final Words

Software development is incredibly mentally taxing.

A lot of other professionals judge developers as lazy people who get to sit in a nice office all day, sipping on coffee or tea. And although this is somewhat true, we all know first-hand that the physical work we don't participate in is recouped tenfold in stressful, challenging, mental work.

Very few professions consist of almost entirely mental problem solving, like software engineering.

Level up faster
Hey, I'm Nick Dill.

I help people become better software developers with daily tips, tricks, and advice.