DEV Community

Cover image for How can developers reduce stress
Adrian Mejia
Adrian Mejia

Posted on • Originally published at adrianmejia.com on

How can developers reduce stress

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 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.

Apps I've used...

MacOs

  • Recess this one of my favorite because it's the simplest and blackout the screen. It keep some stats
  • Be Focused - Timer similar to `Recess` but also has a list where you can keep track of the time spend on each one.

iOS

  • Forest This has a timer and some background music that could help you concentrate.

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.


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!

Eye exercises I've tried...

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


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.

Apps I've used...



iOS

  • WaterMinder You can track the amount of water that you drink and have reminders.
  • Pee & See: Water Reminder 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.

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


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.

Foods to eat more regularly...

  • Nuts
  • Fish
  • Vegetable of different colors
  • Leafy greens
  • Fruits

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).

Apps I've used...

iOS

  • Stronglifts 5x5 Weight Lifting 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.

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.

Devices I've used...


Spire Stone: Stress Management



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:

  • How is my breathing per minute when I’m stress/calm/focus. My BPM: I usually do < 14 BPM when calm and > 22 BPM when stressed.
  • What activities stress me out Location and time when stress

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.

Apps I've used...

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


iOS

  • Breethe: Sleep & Meditation This app has a nice series of guides for beginners. It has a lot of different topics like sleeping, concentration.
  • Simple Habit - Meditation It has a lot of different topics and also many instructors. Having different voices makes more dynamic.
  • Calm It's has a lot of free meditations and ambient music.
  • Headspace: Meditation It has only one instructor you might get bored listening to the same person.

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.


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.

Tools I've used...

  • Rocketbook Everlast Reusable Smart Notebook

    This nice to avoid getting distracted with phone/table notifications and being able to save your notes digitally!
    (evernote/email).


  • Rocketbook App
    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.

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.

Apps I've used...

iOS



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, 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.

Discussion (5)

Collapse
cermitio profile image
Cermitio

When it comes to stress, I often encounter it in my daily life. I have a pretty stressful job, so I was always looking for some remedies to help me cope with stress. Most of all I liked the cbd supplements that I buy from this store. It is good that, unlike various drugs, they have no side effects, and they are also not addictive.

Collapse
renatosuero profile image
Renato Suero

The best habit I started is meditation. I've been used this app insighttimer.com/ for 820 consecutive to meditate, it really help me to deal with my stress

Collapse
amejiarosario profile image
Adrian Mejia Author

Thanks for the recommendation. I'll try that app

Collapse
cheahengsoon profile image
Eng Soon Cheah

When you are the only one person in the company know the technology , you will be stress when no body can help you.