Best Practices

A Programmer’s Guide to Managing Stress

Fatos Morina · Sep 11, 2015 · 11 min read

I almost lost my mind once. It was the best thing that ever happened to me. \n\nI almost lost my mind because I wasn’t taking care of it. Way too much crunch time for an important project, coupled with some ongoing issues in my personal life, pushed my ability to cope with day-to-day life into the red. \n\nI was super, super stressed.\n\nMy heart raced. My mind raced. My ability to think clearlyso important when you’re trying to get working software out the doorwent through the floor.\n\nIt affected everything, including how I felt, my relationships, my sleep and appetite, and especially my ability to do my job. It wasn’t a good placeI was on the edge of somewhere nasty. Burnout.\n\nIt was the best thing that ever happened to me because, while navigating my way back from the edge, I learned a whole heap about how humans work. In particular I learned about our mental and physical limits, the nature of stress and anxiety, and most importantly, how to take care of myself so that I could stop this happening again.\n\nIt’s valuable information, and it applies to everyone. Programming often scores well in terms of job satisfaction, but programmers are humans and are subject to the same limitations as anyone else.\n\n

How stress works

\n\nProgramming culture emphasises excellence and ability. This can make it difficult to admit to ourselves or others that we might be having an issue with stress. \n\n

\n\nHowever, it’s literally baked into our neural and physical circuitry, so everybody has to deal with it at some point.\n\n

\n\n

\n\n

Depositphotos_21603645_m-2015

\n\n

Stress in the mind and body

\n\n

\n\nStress is a series of physiological and mental changes that happen when our body and mind perceive a threat or challenge in our environment. \n\nThe stress responsealso known as fight or flightkicks in when we process information that indicates we’re under threat or facing a challenge. The physical symptoms can include:\n\n

    \n

  • muscle tension
  • \n

  • increased heart rate and blood pressure
  • \n

  • shallow breathing
  • \n

  • nausea
  • \n

  • a sense of mental busyness
  • \n

  • narrow attentional focus
  • \n

  • emotional reactivity
  • \n

\n\n

\n\n

\n\n

\n\nEvolutionary theory offers a neat way of explaining anything that humans experience in terms of survival. \n\nThe stress response can be viewed as a means of keeping us alive by preparing us to meet a challenge.\n\nAll of the physical responses associated with stress serve a purpose. For example, we tense up in preparation for explosive movementvery useful if we’re about to escape from a bear that we’ve encountered on a forest path. \n\nNot always so useful if we’re hunched over a desk running some unit tests… \n\nOr our digestion shuts down so that the energy it uses might be redirected to making our escape, which explains the nausea. \n\n

\n\n

\n\nThe same thing happens with our immune response. Energy is conserved by shutting it down temporarily, at the expense of reduced immunity. This is why you often get sick at times of increased stress, and why excessive stress is associated with long-term, chronic illnesses.\n\n

Stress and the nervous system

\n\nStressed Man Working At Desk In Busy Creative OfficeStress is a pretty low-level response in humans. It’s mediated by the sympathetic branch of the autonomic nervous system.\n\n

\n\nThe autonomic nervous system is responsible for a whole heap of automatic behavior in humansstuff you don’t have to think about, you just do.\n\nThere’s a parasympathetic branch too, which has pretty much the opposite effect when it’s activated. Which is great news, as we’ll see later.\n\nYou can think of these as like the accelerator and brake in a car. You need both to get to where you’re going, but too much of them and you’re either not going anywhere, or driving straight off the road.\n\n

Perception of threat

\n\nAn interesting thing about the stress response is that it doesn’t require the existence of a real, physical threat. Simply remembering a stressful situation can trigger the physical and mental responses. Go ahead, try it!\n\nThe threat response can be activated whenever a challenge or threat is perceived. This is why an email or conversation with your boss can be stressful, even though you are not in immediate physical danger.\n\n

\n\n

Good and bad stress

\n\nA little bit of everything is good, in moderation. Red wine, project management processes, and even stress. \n\n

\n\nStress is actually a pretty useful response in a challenging or threatening situation. One of the many reasons that we’ve thrived as a species is our ability to evade threats and rise to challenges. We need a little bit of stress response in order to get things done. Call this good stress.\n\na man about to throw his laptopFor example, as I’m writing this article, I’m experiencing some low-level stress symptoms. My foot is ticking as adrenaline is released, and my mind feels sharpened as I concentrate on the process of writing. \n\n\n

\n\nWe’ve all been buzzed with the adrenaline of getting through a coding session many times in our career. For some of us, it’s addictive.\n\nLow-level stress provides fuel for getting things done.\n\nThe problems come when our stress response is activated excessively.\n\nEvery programmer has been on a death march at some point. Think about how you feel after a few weeks in crunch mode. You’re probably tired, maybe getting sick, your concentration is waning, and you just generally don’t feel good. Your focus deteriorates, which is no good for your productivity.\n\nIt turns out that continuously flooding your system with stress hormones, diminishing your digestive system and immune response, and being consumed by excessive thinking is not only uncomfortable, but also pretty bad for you in the long term.\n\n

\n\n

\n\n

Programmers and stress

\n\n

\n\n

\n\n

\n\nAll careers have their sources of stress. Sometimes stress is caused by a particular job situation—for example, poor management or team relations. \n\n

\n\n

\n\nSometimes, there are inherent sources of stress caused by the nature of the career itself.\n\nAs programmers, we need to consider a number of factors when examining our relationship to stress.\n\n

We live in our heads

\n\nMost of us turned to a career in programming because we like thinking about things and solving problems. We live in our heads a lot of the time, and are happy that way.\n\nThis means that we can become a bit disconnected from our bodies. Because we’re not always paying attention, it’s easy to ignore some of the physical symptoms of stress. If we don’t notice the problem, we can’t go about solving it.\n\nPart of healthy stress management is noticing when we’re experiencing excessive stress, so we can take appropriate action.\n\n

Cultural expectations

\n\nExtrinsic sources of stress are found in the working culture we operate in. Stress and busyness can be seen as a badge of honour, a sign of a productive employee, or just part of the job. \n\nBecause we’re all amazing super-human code machines (hint: we’re not!), there’s often an expectation that we’ll keep delivering to a super-high standard sprint after sprint, project after project, with no time to rest or repair.\n\nIntrinsic sources of stress come from within ourselves. Programming culture values intellect, which causes us to compare ourselves to others, which leads to impostor syndrome or feeling guilty, both sources of stress in their own right.\n\n

Diet and exercise

\n\nHealthy Living Key Shows Health Diet And Fitness“A programmer is a mechanism for turning caffeine into code,” so goes the old saying. I’d add sugar to that list too! Stimulants like caffeine actually amplify the stress response. Again, this is fine in moderation, but not great long-term. \n\nSitting at a desk all day isn’t exactly conducive to physical fitness. The tension that is part of the stress response can accumulate in the body, leading to huge buildups of stress over time. \n\nDiet and exercise are both definitely part of the equation when it comes to programming and stress. Consider getting more active or taking it easy on the caffeine and sugary snacks for a while.\n\n

Stress management strategies

\n\nSo what’s a busy programmer to do? Stress exists, it’s going to get excessive sometimes, and, in the long term, it’s not good for you.\n\nIf you knew this about a system you’d developed and maintained, you’d take action, right?\n\nThankfully, stress has been thoroughly researched. There are a number of strategies that you can consider when trying to manage stress in your life. \n\nThey fall into three categories:\n\n

    \n

  • Remove the source
  • \n

  • Undo the damage
  • \n

  • Reduce your baseline
  • \n

\n\n

Remove the source

\n\nTaking out the trashSometimes it’s necessary and sensible to work on removing the sources of stress in your life. Think about what causes you the most stress, and work to do something about it.\n\nStart a conversation with your boss about the effect all the overtime is having on your output. Drop that troublesome client. Think about changing jobs if necessary. Ask your family for more support with personal administration if you can.\n\nConsider removing yourself from any toxic relationships in your life. If you’re pressed for time, consider whether you really need all of those hobbies. \n\nIn short, find some time to rest and work on applying the brakes of the nervous system for a bit. \n\nOften there are internal sources we can work on too. What are your beliefs about being busy? Do you see it as important? Is it part of your self-worth? Do you push yourself extra hard, even though it probably wouldn’t matter if you worked ten percent less?\n\nWhat about your outlook? Do you tend to catastrophise? Do you look on every situation with negativity or positivity? \n\nHow about your diet? Your physical exercise routine?\n\nA quick audit of the internal and external sources of stress in your life will provide you with a list of actions you can take to remove them, if possible. It will really help to talk this over with a friend or colleague. It’s sometimes hard to take a clear perspective when you’re in the middle of a stressful period of your life.\n\n

Undo the damage

\n\nOf course, it’s not possible to remove all of the sources of stress in life. If you’ve found a way, untold riches await, so congratulations! And please let me know your secret.\n\nYou can certainly try to undo the damage though. And exercise is an extremely effective way to do this. Exercise release endorphins, which not only feel good, but also act to reduce the negative effects of released stress hormones. \n\nExercise regimes are extremely personal;it can take a while to find one that works for you. My prefered stress buster is yogait combines physical demands with deep breathing, which, as we’ll soon see, is a great way to initiate relaxation. But anything that involves moderate to strong physical exercise will do. \n\n

Pro-active stress management

\n\nWe all have a baseline stress level that fluctuates during our lifetime. By taking a pro-active approach, it’s possible to reduce this baseline.\n\nMaking stress reduction a goal of your life is a worthy goal. The less affected you are by stress, the more effective you’ll be. \n\nEmbrace conscious relaxation exercises, such as the one below. Or learn mindfulness skills, which numerous studies have shown reduce the effects of stress.\n\n

A quick relaxation exercise

\n\nbusinessman doing yoga in officeHere’s a quick exercise that helps most people relax. \n\nIt works on the simple principle that it’s possible to activate the parasympathetic branch of your nervous systemthe part responsible for the relaxation response. You start to slow and deepen your breathing. Slow, deep breathing is associated with parasympathetic response, so when you take control of this aspect of the relaxation response, it tricks your body into activating the rest.\n\nFind a place where you can sit quietly for a few minutes. Your desk will do, but if you can find somewhere you can be alone and undisturbed, that’s even better. \n\nMost of us are shallow, fast breathers, which is associated with the stress response. For this exercise, place your hand on your belly. We’ll focus on breathing deeply. \n\nClose your eyes, take a note of how you feel, and slowly take a breath in. Breathe in such a way that you feel your belly rise before your chest expands. Make the breath as long and slow as you canperhaps it might start out slightly faster, and then slow down. As you exhale, let your belly contract before your chest.\n\nRepeat this for a couple of minutes, generally for around ten to fifteen breaths. Notice any change in your state of mind or body? \n\nHow well did this work for you? \n\n

Do you pass the stress test?

\n\nEveryone has different needs when it comes to learning how to manage stress in their life. How resilient you are in the face of stress is determined by a complex set of biological and environmental factors. Your relationship with stress can, and does, change over your lifetime. \n\nMany people find that learning more about their relationship with stress is very rewarding. Chronic stress is a state of misdirected energy, which causes many aspects of your life to suffer. \n\nThere is a delicate balance between optimal performance and stress. Too little or too much stress kicks us “out of the zone”. \n\nTaking control of excess stress has numerous benefits, whether they be purely physical, such as improved immune function, blood pressure, and so on; or mental, such as clearer thinking, improved focus, and increased likelihood of finding flow states. \n\nAs a programmer, with a mentally demanding job, it’s natural to look for ways to improve the quality of your thinking, and stress management is a direct route. \n\nA stressed person is emotionally reactive, which often affects communication and decision-making. Learning to manage excessive stress naturally leads to emotional balance, which has a knock-on effect in all of your relationships: relaxed people are easier to be around. \n\nProgrammer burnout is a real phenomenon, and often job stress is a big factor. I’ve personally experienced it twice (which is how I came to learn so much about stress!). In all engineering projects, preventative measures are cheaper and more effective long term. So if you feel you’re on the way to burnout, why not apply this approach to stress management in your life?\n\nSo how does stress play out in your life? Just enough? Too much? What could you do today to start reducing the burden?

Fatos Morina

Fatos Morina

John Sonmez is the founder of Simple Programmer, author of "The Complete Software Developer's Career Guide" and "Soft Skills: The Software Developer's Life Manual." He helps software developers build remarkable careers.