How can developers reduce stress
Tags: webdev, discuss, career, productivity
Published: 2019-04-23 18:27:44

---
title: How can developers reduce stress
published: true
tags: webdev, discuss, career, productivity
canonical_url: https://adrianmejia.com/blog/2019/01/03/How-can-developers-reduce-stress/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/cqg6wgkeaq29wihaiacu.jpg
---

Most professions nowadays involve a certain degree of stress. We have deadlines, last minute change of requirements and to deal with customers. On top of that, when you work in front of a computer 8+ hours, additional stressors are added. Your eyes might get dry. Also, the *lack of movement* might cause you back/neck pain, while your **muscles shrink and your belly expands**. This post will give you some tips to accomplish your goals without sacrificing your health. I also included some bonus [tips for software engineers](#stress-management-for-software-developers) at the end of the post ;)

## Background

There was a time in my life, back in 2015, where I went through severe stress crisis. I was juggling too many things at once: writing my first book, traveling to the USA interviewing for new jobs, getting a work visa, and planning a wedding while keeping up with a full-time job and also the sole programmer on two attempts of startups. It was the busiest time of my life, and my health suffered a lot! I dreamt about source code. Some nights I couldn’t sleep, so I worked instead. I went to the ER multiple times with heart palpitations. I knew I could not keep living in that way. 

I’ve been experimenting with different things to see helped and what not. This post is a compilation of the ones that helped. I'll start with general things that apply to anybody working in front of a computer and end with some more specific tips for web and software developers.

# Ideas to handle stress

I’ve been incorporating the following techniques, and it had helped me a lot to cope with stress! I hope they can help you, too!

## Move 🚶‍♂️

Have you noticed that after a long time sitting your energy levels and concentration starts to drop?

Taking a little break to get some movements is an excellent way to boost your productivity!

> Movement => Energy

**Take a 5 minutes breaks after 25 minutes of work**. You can also do 50/10 minutes of work/break. What matters is that you get some rest to move around and take deep breaths while at it.

The 25/5 minutes of work/break is also known as the Pomodoro technique. There are many apps that I have used to remind me to take a break. As simple as it sounds, it’s easy to get carried away when working on a computer and lose the notion of time.

**Note**: working out after work doesn't compensate for a long time of uninterrupted sitting. Your muscle and pain cripple in after a couple of hours static. So, you still have to try walking around at least every hour, so your body doesn’t suffer.

<details>
  <summary>Apps I've used...</summary>

<br>

<p><b>MacOs</b></p>
<ul>
  <li>
    <b><a href="https://geo.itunes.apple.com/us/app/recess/id621451282?mt=12&amp;app=apps" target="_blank" rel="noopener">Recess</a></b> this one of my favorite because it's the simplest and blackout the screen. It keep some <a href="https://i.imgur.com/WZfeTLy.png" target="_blank" rel="noopener">stats</a>
  </li>
  <li>
    <b><a href="https://geo.itunes.apple.com/us/app/be-focused-pro-focus-timer/id961632517?mt=12&amp;app=apps" target="_blank" rel="noopener">Be Focused - Timer</a></b> similar to `Recess` but also has a list where you can keep track of the time spend on each one.
  </li>
</ul>

<br>

<p><b>iOS</b></p>
<ul>
  <li>
    <b><a href="https://itunes.apple.com/us/app/forest-stay-focused/id866450515?mt=8" target="_blank" rel="noopener">Forest</a></b> This has a timer and some background music that could help you concentrate.
  </li>
</ul>

<p>I don't use Android/Windows very often, so if you have suggestions write it down in the comments, and I'll add it here.</p>

<hr>
</details>

Taking breaks can also reduce eye strain. I suffer from dry eyes from time to time. When we stare at a digital screen, we don’t blink as often causing our eyes dryness. There’s also a rule of thumb 20-20-20. It means that every 20 minutes, you look at something of 20 feet away for 20 seconds. At one point I also notice that my eyesight was getting worse, so I also incorporated some eyes exercises during the break. That also helped with the dryness a lot!

<details>
  <summary>Eye exercises I've tried...</summary>

  <ul>
    <li>Blinking rapidly around 20 times. It helps with the dryness.</li>
    <li>Extending my thumb as far and close to my eyes as I can.</li>
    <li>Doing circles with thumbs while my eyes follow them. You can also look up and down, and right to left.</li>
  </ul>
<hr>
</details>

## Brainstorm 🧠

Have you felt stressed when you get stuck on something for a while? (e.g., No syntax errors and still the code is not working as intended). Well, it’s time to take a step back and put things in perspective. There might be a straighter line to get to your goal. **List all the alternatives** or different ways you can solve the same problem. Whatever you can think of (don’t label them as “good” or “bad”. Put down the “smart” ideas and especially the “dumb” ones. In the end, choose the ones that you think will work best. Work smarter, not harder!

If you are going to cut a tree is essential to sharpen your ax first and then get to it. Not just will you cut the tree faster but also with less effort. Likewise, it’s vital that you take some time to do a little planning before jumping right into the task in hand. Beware of not overdoing it, set a time limit for this exercise. If you spend all the time sharpening the ax and never cut the tree is not good either ;)

## Subtask ✌️

**Divide a big task into smaller ones**. Completing some small tasks will motivate you to get more done. Also keeps the stress away since you feel you are making progress. Another benefit of sub-tasking is that makes estimations more accurate.

Even the most ambitious projects and tallest buildings started with laying down one block at a time. Likewise, no matter how big your project is when you break it down into smaller pieces, that you make it easier to reason about.

Tackling a small task is less daunting to deal with the project as a whole, so you will be less likely to procrastinate and stress about it.

## Prioritize 🎯

Most of us have an endless TODO list where things get added a lot faster than we can check them off. An infinite list of things to do, stress us big time. What if I tell you, that in most cases you only need to **complete the 20%** of the list to reap 80% of the benefits? 😲🤯

**If you can’t do it all, then prioritize**. Do what matters the most upfront. 20% of the task might account for 80% of the result (Pareto Principle). Find that critical 20% and execute on that first. For the rest of the list, you can apply the 80/20 principle recursively. Find the next 20% that matters the most and for the rest use Pareto again, delegate or re-evaluate if is still needed.

## Ask 🗣

If you have more on your plate more than you can chew, then share with others. Don’t choke alone. **Ask for help**. 🙋🏻‍♂️

When you ask for help, the other person usually feels good. You are creating a bond and companionship with that person. However, don’t overdo it! Otherwise, it will have the opposite effect. Before asking for help, you should do your homework. Try to solve it yourself first, google it and struggle with the issue a little while. Write down some questions and where you got stuck (exact error messages, etc.) The other person will appreciate that you are respecting their time and that you are asking detailed questions.

* * *
When we neglect our body the proper care, we also can become sick which will take productivity to the floor. The following tips will help our body to cope with stress and keep health.
* * *

## Drink 🚰

Stay hydrated. **Your brain is mostly water so don’t let it dry**. A good rule of thumb is to drink half of your weight in ounces (e.g., 170lb -\> 85 oz. water).

Your body is a fantastic machine that tries to keep the balance regardless of what we throw at it. It remains a specific temperature when it’s freezing by shivering or sweating when it’s hot. It seeks to maintain the pH of your blood even if you drink too many acidic beverages (sodas, coffee). It tries to keeps your blood sugar on check even after eating a donut or if haven eaten in hours. However, our bodies need the proper nutrients and water to do so. When you don’t hydrate yourself enough, it can’t remove the waste out of your system. So, drink up!

Another way to know if you are hydrated is by monitoring how often your pee (crazy, right?). If you haven’t pee in 3 hours, you need two glasses of water ASAP.

<details>
  <summary>Apps I've used...</summary>

<br>
<b>iOS</b>
<ul>
  <li>
    <a href="https://itunes.apple.com/us/app/waterminder/id653031147?mt=8" target="_blank" rel="noopener">WaterMinder</a> You can track the amount of water that you drink and have reminders.
  </li>
  <li>
    <a href="https://itunes.apple.com/us/app/pee-see-water-reminder/id1090749982?mt=8" target="_blank" rel="noopener">Pee &amp; See: Water Reminder</a> Alternative method of measuring hydration. Instead of logging the amout of water drank you log how often you pee. If you haven't pee in 3+ hours you will get a reminder to drink more water.
  </li>
</ul>

<p>I don't use Android very often, so if you have suggestions write it down in the comments.</p>

<hr>
</details>

## Nourish 🥦

How productive are you when you are sick? Exactly! You get almost nothing done and spend your time googling symptoms. On top of that, your stress increases and the deadlines get closer and you unable to make the process. A well-nourished body gets sick less and has more energy. You would be more productive!

Supplement yourself with **vitamin C** & fruits. Vitamin C helps your body to quickly clear out Cortisol, which is a hormone correlated to stress. It also keeps your immune system healthy. **Magnesium** from leafy greens helps to relax the muscles among many other benefits.

<details>
  <summary>Foods to eat more regularly...</summary>

<ul>
<li>Nuts</li>
<li>Fish</li>
<li>Vegetable of different colors</li>
<li>Leafy greens</li>
<li>Fruits</li>
</ul>

<hr>
</details>

## Stretch 🙆‍♀️

Prolonged sitting is the new smoke. It might increase your body weight, back, and neck pain. Even if you exercise an hour before/after work, still you are hurting yourself for sitting too long at once. You have to break sitting often.

As discussed before, try to break sitting every 25 minutes or an hour with some stretching session. Our bodies are not designed to stay 8 hours per day sitting still. It was designed to move. Indeed, great ideas happen when you are on the move (showering/walking). If you are stuck with some task, take a little walk, stretch out and might give you some perspective.

## Workout 🏋️‍♀️

Move your butt often, get some sweat in your forehead. Working out releases endorphins that increase your sense of well-being.

Working out your muscles can help you release tension and reduce your mental stress. However, don’t overdo it or it can backfire you. Try to avoid getting injured by doing small progressive changes rather than going too big the first day and then not being able to walk nor shower (I've been there).

<details>
  <summary>Apps I've used...</summary>

<br>

<p><b>iOS</b></p>
<ul>
  <li>
    <b>
    <a href="https://itunes.apple.com/us/app/stronglifts-5x5-weight-lifting/id488580022?mt=8" target="_blank" rel="noopener">Stronglifts 5x5 Weight Lifting</a></b> I have used this program for 6 months and I have seen very good results. It's simple and have a nice tracker and videos how to do each exercise.
  </li>
</ul>

<hr>
</details>

## Breath 💨

If you are reading this, it means you are breathing (of course!). However, not all breaths are equal! 👀

Take some profound and slow breaths from time to time. When we are stressed out, we breathe very fast and shallow.

Proper breathing is vital for relaxation. You can avoid/overcome panic attacks. Just sitting relaxed and being aware of your breath when the air goes in and out can cool off your mind, reduce your heartbeats and blood pressure.

Some devices can track when you are tense, focus or calm. Guess how they do it? That’s right with your breathing. I have used Spire. I think it’s useful to receive feedback when I was getting tense and try to take some deep breadth right there.

<details>
  <summary>Devices I've used...</summary>

<br>

  <b>
    <a href="https://amzn.to/2RxFBFi" target="_blank" rel="noopener">Spire Stone: Stress Management</a>
  </b>
  <br>
  <a target="_blank" href="https://www.amazon.com/gp/product/B00TH3SQOI/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B00TH3SQOI&amp;linkCode=as2&amp;tag=adrian0ea-20&amp;linkId=af991d73cb812919c0e03644226f41e8"><img border="0" src="https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;MarketPlace=US&amp;ASIN=B00TH3SQOI&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL250_&amp;tag=adrian0ea-20"></a><img src="https://ir-na.amazon-adsystem.com/e/ir?t=adrian0ea-20&amp;l=am2&amp;o=1&amp;a=B00TH3SQOI" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;">

<p> This one you wear it on your belt or bra. It will capture your breathing. I sometimes forget to wear it or where I left it. But, I learned a couple of things after wearing the device:
  </p>

<ul>
    <li>How is my breathing per minute when I’m stress/calm/focus. <a href="https://i.imgur.com/GjYPPpm.png" target="_blank" rel="noopener">My BPM</a>: I usually do <code>&lt; 14 BPM</code> when calm and <code>&gt; 22 BPM</code> when stressed.
</li>
    <li>What activities stress me out <a href="https://i.imgur.com/O71NzJb.png" target="_blank" rel="noopener">Location and time when stress</a>
</li>
  </ul>
<hr>
</details>

## Meditate 🧘‍♀️

Meditation is trending now but still sounds a little strange for some people. It’s not about doing the lotus position you can do it sitting in your office chair, bus, train (but not while driving please). Simply put, meditation is focusing on the “now” because most of the time we get carried away fearing “future” situations that might never happen or worrying about a “past” that we can’t change. All we got is *now*.

One of the best ways to be present is **being aware of your breathing**. Breath always in the present. So, the basis of meditation is mindful of your breath, and that alone can be calming.

<details>
  <summary>Apps I've used...</summary>

<br>

<p>There are many apps that you can use for helping you pick up the habit of being present and relax:</p>

<br>

<p><b>iOS</b></p>
<ul>
  <li>
    <b>
      <a href="https://itunes.apple.com/us/app/breethe-sleep-meditation/id920161006?mt=8" target="_blank" rel="noopener">Breethe: Sleep &amp; Meditation</a>
    </b>
    This app has a nice series of guides for beginners. It has a lot of different topics like sleeping, concentration.
  </li>

  <li>
    <b>
      <a href="https://itunes.apple.com/us/app/simple-habit-meditation/id1093360165?mt=8" target="_blank" rel="noopener">Simple Habit - Meditation</a>
    </b>
    It has a lot of different topics and also many instructors. Having different voices makes more dynamic.
  </li>

  <li>
    <b>
      <a href="https://itunes.apple.com/us/app/calm/id571800810?mt=8" target="_blank" rel="noopener">Calm</a>
    </b>
    It's has a lot of free meditations and ambient music.
  </li>

  <li>
    <b>
      <a href="https://itunes.apple.com/us/app/headspace-meditation/id493145008?mt=8" target="_blank" rel="noopener">Headspace: Meditation</a>
    </b>
    It has only one instructor you might get bored listening to the same person.
  </li>
</ul>

<p> I'm sure there are many other apps for this but this is the ones I've used, and they are in my order of preference. </p>

<hr>
</details>

## Play 🎮

After a long session of work, what’s your reward? If you go home to continue working and or doing mentally taxing activities, then you will burn out quickly!

If you don’t rest properly, the next day your focus will be all over the place. Also, the urge to procrastinate will be strong in you. Your mind will be looking for any chance to get a break.

Solution? Have some **planned** downtime! After some time of work well done, reward yourself with something that you enjoy. Playtime! Do something that put a smile on your face 😊. Do something that makes you laugh 🤣.

> Life can’t be all broccoli and no dessert.

Have some fun and plan for it!

## Write ✍️

Journaling is one thing that helped me the most to calm my racing mind before going to sleep.

Use journals to write down thoughts, worries, plans, and let your mind run wild. Also, it helps a lot to write down things you are grateful on that day. It would make you feel better when you see written down some things turn out great on that day! Even in the worse days, there are a few things that you can be thankful for.

Like brainstorming doesn’t label your writing as bad or good. Just let it flow and write down what’s on your mind.

Some people do it in the morning like Tim Ferris, I have seen a lot of benefits doing it at night. Find the time that works the best for you.

<details>
  <summary>Tools I've used...</summary>

  <ul>
    <li><b><a href="https://amzn.to/2RxM3w0">Rocketbook Everlast Reusable Smart Notebook</a>
      </b>
      <span>
        This nice to avoid getting distracted with phone/table notifications and being able to save your notes digitally!
        (evernote/email).
      </span>
      <a target="_blank" href="https://www.amazon.com/gp/product/B06ZXWVZ3X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B06ZXWVZ3X&linkCode=as2&tag=adrian0ea-20&linkId=b0e7cd8801dc03ea32af135c8222b701">
        <img border="0" src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=B06ZXWVZ3X&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=adrian0ea-20">
      </a>
      <img src="//ir-na.amazon-adsystem.com/e/ir?t=adrian0ea-20&l=am2&o=1&a=B06ZXWVZ3X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
    </li>
    <li><b><a href="https://itunes.apple.com/us/app/rocketbook-app/id1036898971?mt=8">Rocketbook App</a>
      </b>
      This app allows converts picture from your notebook to scans and sends them to your inbox, Evernote/Onenote/Dropbox. It also has some AI to recognize handwriting and transcribe it. It's not perfect but does a decent job if you have clear handwriting.
    </li>
  </ul>

  <hr>
</details>

## Sleep 😴

I neglected this one for some time. The truth is that we sometimes think if we sleep less, we would have more time to get stuff done. However, that’s not usually true. Your productivity/creativity decreases so much. If you are well-rested, you can solve problems in much less time.

The science of what happens while we sleep is still ongoing and fascinating. We know that memory consolidation happens while you sleep, your body repair itself, waste is removed from the brain. Your heart rate drops around 20%, and your stress hormones go down. Your nervous systems heal making you more responsive and sharp after a good night sleep.

Also, we have an idea of what happens when we don’t sleep much for a couple of days. We have problems concentrating. The quality of our work decreases and or creativity suffers. You might have headaches, darker shades under your eyes among other things.

Do you know having a good night sleep starts during the day? After a very stressful day or some big event coming up, for most people, it’s hard to sleep well (if at all). That’s why doing breathing exercises through the day helps. Also, taking breaks every 25 or 50 minutes of work. Journaling helps me a lot to calm down my monkey mind jumping all over the place at night.

<details>
  <summary>Apps I've used...</summary>

<br>

<p> <b>iOS</b></p>
  <ul>
    <li>
      <b>
        <a href="https://itunes.apple.com/us/app/autosleep-tracker-for-watch/id1164801111?mt=8" target="_blank" rel="noopener">AutoSleep Tracker for Watch</a>
      </b>
      Keeps track of your sleep automatically. I used with the Apple Watch and works pretty well so far.
    </li>
  </ul>

<hr>
</details>  


***

## Stress management for Software Developers

All the recommendations above could apply to anyone working at an office. In this section, we are going to give some more for people working with technology that changes very fast (like Software Developers).

### Information overload 🤯

Innovation in tech is happening at an unprecedented pace, and it will keep accelerating. Don’t feel like to have to learn everything new that comes out. Try to focus on the foundations and principles very well, since they are not changing anytime soon (E.g., [Algorithms](https://dev.to/amejiarosario/how-you-can-change-the-world-by-learning-algorithms-549c), Design Patterns, and so on)

If you are a front-end engineer, you notice that new web frameworks pop up in a relatively short time. However, the most popular ones are adopted by the industry and takes a while (a couple of years) to move away when new/“better” ones come along. So, don’t feel pressure if a new shiny tool is all the hype and you don’t know about it.

For backend and DevOps developers, there are paradigm changes from time to time. E.g., from monolith to microservices, from server rendered apps to SPA (single page applications) or hybrids. Also, people are talking about serverless, and the JAM Stack (JavaScript, APIs, and Markup); Docker and Kubernetes; The list keeps growing… Again don't throw everything you are doing and follow the buzzes.

All in all, don’t feel like you need to rearchitect your stack right away and throw what’s working for something new. Prefer battle-tested solution for production environments rather than shiny ones. Don’t follow the hype blindly. Evaluate your use cases carefully have proof of concepts (POC) test them. What worked for Google/Facebook might not necessarily be the right tool for you. You can benchmark multiple solutions before going all in and make a decision based on data rather than hype.

## Testing 🐞

Test your code. Unit test and integration/e2e tests are not a nice to have; **tests are a must** if you want to sleep well at night. Even if your company has a QA team, try to write automated tests. Add test coverage tools and try to keep it as close to 100% as possible. That will reduce you a lot of stress chasing bugs in production and unexpected angry customers.

## Refactoring 🛠

I have been battling my perfectionism for years. Every code I see that could be better, I feel the urge to modify it. Initially, I did, and my number of changes got so big that when something broke, it was hard to tell what’s wrong :(

Keep your changes small. It’s easier to review small pull requests (PR) than a large one. Divide significant changes into multiple small ones if it makes sense.

Also, have respect for the working code. There might be smarter ways to solve a task. However, you don’t know if you are going to introduce new bugs.

Try this:

1. Make it work, first. You should try to add new functionality and make it work. That's it: no refactoring, no clever tricks but lots of tests. Open up a PR and get it merged.
2. Make it faster, later. Now that we have something working and it has tests; it’s time to get smart and refactor.

***

That's all I have! Comment below what you do to keep stress low and productivity high.