DEV Community

Cover image for Does programming professionalise anxiety?
Daragh Byrne
Daragh Byrne

Posted on

Does programming professionalise anxiety?

Like many of you , I've suffered from anxiety on and off over the years. From time to time I've been crippled with fear, locked in unhealthy, negative thought patterns that have on occasion rendered me paralyzed, unable to attend to my work effectively and a burden on my relationships.

Thankfully it bothers me way way less these days - there are several practices and resources that I draw on to make sure that remains the case. (I've learned a fair bit over the years about how to work with it, it's one of the main reasons I started sharing at CodingMindfully.com).

I've pondered the relationship between programming and anxiety many times over the years. I've often asked - does programming professionalize anxiety? And if it does, what can be done about it?

Programming and worry

A good programmer considers all the different ways something can go wrong in their code. From checking input values, to thinking about UX, to finding the edge cases of algorithms, to being worried about how the next person to read your code might think of it - there’s good reason to worry!

All of which is excellent for your coding skills, but isn’t always much fun when you can’t let go of those worries while away from the screen.

Here's a list of things I worry about on a day to day basis:

  1. How do I begin to understand this codebase?
  2. Should I use a fancy data structure here or is an array just fine (again)?
  3. Why do I never use fancy data structures and algorithms? I'm so average at programming.
  4. OMG I've just broken production!!! Oh no wait, it's all good...
  5. Is this merge conflict my fault? Surely not, right? Oh wait... that's totally me.
  6. Am I ever going to be smart enough that solving this problem feels easy?
  7. If I write it like this, will it fall over with a bigger dataset?
  8. What happens if the user doesn't understand this layout?
  9. What happens if the user puts garbage in this field?
  10. Is that a good name for this variable?
  11. Why is this client so questioning of my work?
  12. Will someone else understand this code? Will I understand this code in a week? A year? (Possibly not!)
  13. Am I going to survive in this career (18 years later and I still have this one!)
  14. Does team-mate think I'm an idiot?

I could go on but you probably get the idea! Suffice to say, worrying about what might go wrong is a big part of a programmer's job.

Negativity as a survival mechanism

As programmers, making our living or deriving our pleasure from our minds - so it's important to know how it operates. The job of a mind is to keep you alive. Our minds often operate in one of two modes - rehearse or review.

In rehearse mode, our minds prepare us for threats and challenges it anticipates we might face. You can think of this as future-facing worry. It's the mind preparing us to be ready for the worst. This is the source of much of our anxiety.

In review mode, we're running things from the past over in our minds over and over again. The aim of the mind is to try to learn from events that we've experienced, so that we might not commit the same errors again.

Humans have a natural inbuilt negativity bias. This means that we give more mental weight to situations and events we perceive having a negative impact on ourselves - the weighting is said to be 80/20 in favour of negative events.

This negativity bias pervades both our rehearsing and reviewing modes of mental operation.

Our minds are designed to keep us safe, but the price is often a tendency towards worry and anxiety. It's possible that programming professionalises the negativity bias by encouraging us to be hyper aware of what me might get wrong.

It can mean that we, as coders, suffer from anxiety to a degree that isn’t as comfortable as we might like.

So what's to be done? Chronic anxiety can be worth seeking professional help - I've done it in the past, without shame. Along the way I've learned a few things about how to work with my own negativity bias, which I'll share now.

Counteracting the negativity bias

It takes conscious efforts to deal with the negativity bias. It's rooted pretty low down in our psycho-physical system. There's a few things you can do to counter it though.

Practicing positive emotions

It turns out your mind can be trained in positive emotional states using a principle called Taking in the Good as explained by Rick Hansen. In this viewpoint, feelings are a skill that can be developed with practice.

The way to do it is pretty straightforward:

  1. Notice when you're feeling in an enjoyable mood state
  2. Explore how that really feels in your body and mind - take in the sensations, thoughts and movements of energy

You can do it now by simply remembering your happiest event and tapping into how it makes you feel in your body - let me know how you go.

Gratitude

If you're finding it hard to remember or experience positive emotions, a great place to start is the practice of gratitude. The idea here is to start training your mind to look for positive situations (no matter how small). The more time you spent looking out for things to be grateful for, the less time you have to spend worrying!

It's really easy to start practicing - all you have to do is end your day by writing three things you're grateful for on a piece of paper. It could be something that went well at work that day.

For example, moving a ticket from In-Progress, to Done - this can be super satisfying if you let it be. Or even just getting those pesky unit tests to finally pass!. Or remembering an act of kindness by someone who has been good to you. Or just that you enjoyed a coffee that morning.

Try it for a week and see!

Mindfulness

As you'll probably know by now, one of my tools of choice is mindfulness meditation (which helps me detach from the negative thought loops I sometimes find myself lost in).

I find my way out of anxious states a lot more quickly, because I've learned to recognise them as the arose rather than when I'm already deep inside. Meditation also helps me to release stress and tension which also helps.

There's plenty more to read about my story with anxiety here.

How about you? Are you an anxious programmer? What would you add to the list above? And what are you grateful for??

Top comments (6)

Collapse
 
mycarrysun profile image
Mike Harrison

Awesome points on how to counter act the default negative thoughts!! It definitely can be reversed but it does take conscious effort. The two best methods I've found for my personal stress to be on average lower, is meditation in the morning right after working out, and then also practicing gratitude. Also just trying to find the good in things like you said. The words you say have a lot more power than you think. Even the words you are saying to yourself in your mind. Be careful what you're saying because our brains are computers and we are programming ourselves to continue thinking in the same way in the future just by performing a thought. CRAZY concept but it's true based on neural pathways getting stronger the more they are used. And it starts to become a reflex. It is much more enjoyable to train your brain to be reflexive in thinking of the positive rather than the negative.

Collapse
 
dmfay profile image
Dian Fay

To take the semi-rhetorical question in the title at face value: not any more than welding, writing, or cooking do, or really any occupation where it's possible to screw up or fail somehow (which is about all of them). It might be interesting to consider whether programming holds a particular attraction for people already disposed toward anxiety and other neuroses, but I don't have any data to hand on that.

I've found cognitive-behavioral therapeutic techniques helpful, although it takes a bit of practice to be able to take that step back and force yourself to think critically in the moment.

Collapse
 
codingmindfully profile image
Daragh Byrne

A fair point! I’ve likewise applied CBT and mindfulness techniques for the same reason.

I’d love some data on this too - anecdotally I’ve encountered many programmers who’ve tipped into chronically difficult emotional territory. I wonder if there is something about the mental nature of programming and the particular ease with which bugs can be created. Thanks for your reply!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.