How to stay sane as a programmer
Thursday, July 01, 2021

It is every developer's (in this case programmer) dream to be highly effective and productive at work but also resist distractions at all costs. It doesn't have to always be so, there are ups and downs.

The worst thing I’ve done to myself so as to code more is cutting off my sleep. Of course, this leads to serious health and mental issues.

The majority of programmers devote a significant amount of time to writing codes and thinking about how to solve problems or how to create a new feature. A programmer will always want to sleep once the bug in their code is solved. We lay up all-time in thinking, researching, coding and testing. This kind of career needs consistent focus. Sometimes certain features take days to research and seconds to implement.

Programmers reading this, you will be nodding your head as you move your eyes around the text here. Take a moment to marvel at and understand the world of programmers better if you work with them.

Here are a few things that I’ve tried personally and have helped me to stay sane as a programmer.

Measure your time

You get so engrossed in your programming that you just want to code. You can feel the solution waiting for you a short distance away with every code run and error occurrence. You forget about your meal for several hours, your eyes begin to flush, and your trigger fingers begin to itch because you don't want to stop, even for a minute. You believe that if I solve this problem, "I will be able to commit and take a break.” I'm going to fix just one more error…

Measuring time has helped me realize just how serious it is to be active at all times. After coding the whole day, you’ll feel exhausted and hungry. I prefer spending 3-4 hours of undisturbed workflow - the deep work route.

You can use your stopwatch or an app and log time just as a reminder to take breaks every once in a while.

Understand before you start to code

First, make a high fidelity prototype of the design idea, if you do your design first, you’ll know what you want to do. Having your design somewhere on paper or notepad will help you not to code longer than you should. You might not have a clear idea of how you want to do it, i.e. how to implement it. Or even if what you want to do is reasonable or possible. But you know what you want to do.  

Jumping straight into coding without creating high fidelity mockups will slow you down because you do not have the basic visual branding and style fixed down so you will easily lose direction when coding. Focusing on coding according to the design mockups is definitely a better path to take.

Do not reinvent the wheel

Check if there are existing libraries so that you do not need to start building libraries from scratch yet they exist. Do a little research - has this been done before, what's the best technology and tools used, etc.

A programmer's average day does not consist entirely of continually typing on a keyboard, writing code, and solving problems. Programmers spend a lot of time reviewing log files, researching technical issues, testing things out, and experimenting with applications.

Have your Crew

Programmers are not an island. I believe that programmers are more likely to work alone or in a siloed department. They also put in a lot of effort and create their contributions in solitude, believing that the finest creative work is done in a kind of safe zone away from the rest of the company.

If this is you, then you need to reach out. To keep mentally and physically fit, you'll need a good team. People who are upbeat, empathetic, and hilarious, and who will share a drink (or coffee, in my case) with us when things go wrong or we feel overwhelmed.

Humans are wired for social interaction. There is no getting around that. You must be a part of a team to which you feel a sense of belonging.

Celebrate the eureka moment

You could be working on something new or trying to solve a particularly troublesome bug. You spend hours and days browsing it on the internet, reading the relevant docs, researching it and looking for any hint about how to proceed further. Perhaps you will find nothing at the end of the day. You may have spent your entire workday deciphering the code and experimenting with several variations. And then that magic happens, you feel relieved. 

It was a straight and simple solution, you wonder why you didn’t think of this before instead of wasting days. Playing the victim only adds stress to the already stressful situation that you have passed through.

Go off the grid

It is really hard to shut down and pull yourself away from your computer and totally disengage from the electronic world. However, it is imperative to do just that; otherwise you are in danger of frying your brain and burning out.

Not only do programmers need this tip, but any other person working on a project, especially if you are in a collaboration with more than one programmer. Train yourself and let others know that you are off the grid for a specific period of time such as evenings or weekends. It's necessary to give your brain time to relax, de-stress, and recharge.

For some, the temptation to spend 12 hours a day in front of a screen is irresistible. Any time not spent coding appears to be a waste. This is, in my opinion, the wrong way to go about it. Taking time to pursue other interests is beneficial to your mental and physical health, as well as maintaining your sanity and avoiding burnout.

The writer is a Computer Science program lead and faculty with over ten years of experience in teaching things on the computer. She is a matron for the Women in Tech Club. Currently, she is pursuing a Ph.D. in Data Science.