Coding with Anxiety

Coding with Anxiety

How it Can be a Positive Force in Programming

This post is very unusual. This is a very personal and possibly risky one - as mental health is still stigmatized.

But the truth is, there are so many people struggling with anxiety and depression, seeing no hope or way out.

I am going to focus on my personal experience, so I will be focusing on Anxiety more, though I hope this will be helpful for people with other related conditions.

TLDR: I believe it's not only possible to be a successful programmer while suffering from anxiety and depression, but, to some extent, these conditions can help one to become a better employee or even person. That what my experience tells me, at least.


I am writing this in a good faith with a desire to help but I am not a doctor. This article is not intended to be a substitute for professional medical advice.

If you are struggling with anxiety or depression, it is important to seek out professional help.

My usual go-to place for getting health-related information (apart from speaking with the doctor, of course) is the NHS website. If you're in the UK, you can also consider speaking with your GP or calling 111.

What is Anxiety and Depression?

Anxiety and depression are both mental health conditions that can affect people of all ages and backgrounds.

Anxiety is characterized by feelings of fear, worry, and uneasiness and can lead to physical symptoms such as headaches, nausea, and difficulty sleeping. Sometimes it can also lead to panic attacks, a very nasty and scary experience, usually appearing at the least convenient time. It can manifest itself in sudden unexplained episodes of fear, nightmares or just overconcentration on safety or one's health.

Depression is another mental health condition, characterized by feelings of worthlessness, sadness, and fatigue. It can also lead to physical symptoms such as difficulty concentrating, and changes in appetite. Sometimes it would manifest as a lack of any emotions at all.

It is estimated that 1 in 6 people in the UK suffers from some form of anxiety or depression, and this number seems to be growing (source: For software developers, the prevalence of these conditions is even higher, with some studies showing that over 25% of software developers suffer from some form of anxiety or depression.

These mental health conditions can have a major impact on a person’s ability to do any day-to-day activities, even as simple as shopping. For example, I had a panic attack while choosing some mince in Aldi which made me freeze unable to do anything meaningful.

The problem is only bigger for demanding tasks such as programming. Anxiety and depression can cause difficulty focusing, difficulty problem-solving, and difficulty staying motivated. This can make coding a very challenging task for those who are suffering from anxiety and depression.

One can actually become less smart and attentive to details, leading to worries about loosing or not being able to get a job, which makes you even more anxious and less smart and attentive to details...

You can still be successful at coding even if you suffer from anxiety and depression

That was the bad news. Depression and anxiety are not rare, and they can be really challenging to cope with. The good news, however, is that you:

  • You can still be a successful programmer, even if you have a mental health condition

  • It is treatable, or, at the very least, manageable

  • It is not that debilitating as one might think.

When I was passing my interview at Amazon, I was in very bad shape, struggling with frequent panic attacks. There was no miracle, and despite all my preparations, I had a really bad panic attack during the coding challenge. Instead of giving up, I continued and interviewed, pretending I was thinking about the solution.

Yes, I was not thinking of any solution and was processing my emotions instead, so I lost 10 minutes. But I didn't fail the interview. If I could do it - you can do it too.

So how one can stop mental health conditions from getting in the way of one's career?

There are several strategies that can be used to manage anxiety and depression. The first thing you should probably do is to speak with a doctor. GP is OK for a start but I'd also recommend speaking with psychiatrist too. They will provide you with proper diagnosis, and will often recommend either some medicine and talking therapy (usually CBT). I will come to the CBT back in a bit, but there're some things I'd like to mention before.

It is also important to take care of your physical health. Eating healthy, exercising, and getting enough sleep can all help to reduce anxiety and improve focus. Taking time to relax and unwind can also be beneficial, as it can help to reduce stress and improve mental clarity.

It is important to have a support system. Talking to a friend or family member can help to reduce stress and make coding more manageable. It can also be beneficial to connect with other programmers who are struggling with similar issues, as this can provide a sense of understanding and support.

How suffering from anxiety can make you a better employee and a person

While it can be difficult to code when suffering from anxiety or depression, it is important to remember that these mental health disorders can also be a source of strength and resilience. Or, more specifically, CBT and mindfulness practice will provide you with great self-reflection tools, which will help you to become a better person.

Anxiety and depression are not appearing out of nowhere. It is more likely that our environment and genes "prewired" us to have a particular thinking habits, which looked like helpful at first but eventually got out of control.

As an example, it might be reasonable not to have very high hopes for success if chances are against you. However when it becomes a habit to expect the worst, it's starting to be a problem.

Similarly, it might be prudent to look after your health, but when you're becoming preoccupied with whatever is happening with your body, constantly looking for symptoms of some deadly disease - you're having a problem.

CBT (cognitive behaviour therapy) and mindfulness (practice of paying attention to what is actually happening, rather than getting caught in one's thoughts) are helping you to first recognise those unhealthy thoughts and then unwire your thinking patterns, so you could build more healthy one.

If you're successful at this, you did something which many thought were impossible - you reprogrammed yourself. To manage your anxiety and depression symptoms you will have to practice this reprogramming regularly.

This is superpower, one which I think isn't available for people who didn't go through this struggle in the first place.

And if you're thorough with your therapy you will likely to see unhealthy things in your life - which you didn't see before. When you see them you can either fix or get rid of them.

For example, before going through therapy I didn't realise that I was not only suffering from anxiety, but I also was depressed. That was because I struggled to be perfect parent and husband, and I didn't pay enough attention to my needs as the result.

If it were not to my panic attack which lead me to seek professional help I could have never know it.

I also started to notice that my emotion were connected to my physical state. I am more anxious if I didn't sleep well, and I am more easily irritated if I am hungry. I started to pay more attention to what is going on in my head, so I could react faster. As a result I became way less difficult and more creative and flexible when professional conflict happens - simply by being aware when it's a good time to have a break and a snack.

Creating a Positive Work/Life Balance for Programmers

Creating a positive work/life balance is essential for anyone who wants to be successful at coding, and even more so for programmers suffering from anxiety or depression. It is important to take time off to rest and relax, as this can help to reduce stress and improve focus. It can also be beneficial to take breaks throughout the day and to make sure to get enough sleep each night. I'd recommend Pomodoro routine, but pick up any routine which works for you.

It is also important to practice self-care. Taking the time to do something that you enjoy can help to reduce stress and improve mental clarity. Counter intuitively, playing computer games or watching TV shows during my work breaks make more MORE productive.

And to make it all possible you can consider working from home, if it works for you. It does work for me tremendously - as I can have space whenever I need it.

Finally, it is important to remember to be kind to yourself. It is important to remember that everyone makes mistakes and that it is ok to make mistakes. By practising self-compassion and acknowledging your feelings, you can learn to accept yourself and your mistakes. It's not the mistakes good employees would be looking for, but the desire (or lack of it) to learn from those mistakes


Coding with anxiety and depression can be a difficult and daunting task. However, with the right strategies, it is possible to manage the symptoms of anxiety and depression and still be successful at coding. Seek professional help as soon as you feel something isn't right - as with all likelihood the problem will not go by itself.

By creating a routine, taking breaks, and practising self-care, it is possible to make coding more manageable and less intimidating. It is important to remember that anxiety and depression treatment, such as CBT and mindfulness pracices can be a source of strength and resilience.