3 tips for developers to have a good night’s sleep
- Do you have difficulty letting go of your work?
- Do you still think of your projects after you get home?
- Do you think of your code even in your sleep?
- Do you have trouble getting back into the context of your work in the morning?
If you answered yes to at least one of these questions, here are some tips for you. The human brain is a wonderful machine, but it is often uncontrollable. If the success of your projects is important to you, it is safe to bet that your worries follow you home when you leave the office. How many times have I thought, or even dreamed, of a less demanding job? I remember my job as a cashier at Costco (Price Club back then) when I was a student, where I left work without thinking of my job overnight. Today, my work requires that I reflect and retain a lot of information in order to be effective. Let me tell you what I do to free up some of my worries. Here are 3 tips to help you have a good night’s sleep:ù
Tip 1 First of all, I hate starting the day with the “You broke the build” sign on my desk. However, I love being the one who puts it on the desk of one of my colleagues. I rarely wait for the continuous integration to start the build. I do it myself before leaving at night. So, I know that the next day I will not be the wretch who broke the build.
Tip 2 Another good way to sleep better is to have less code to support. My best days are those when I leave the office with fewer lines of code than I had in the morning. In development, too many lines of code are often written for the actual needs. During a code review session where I saw a colleague write code to fix a bug, I asked him: “Do you really believe that you’ll reduce bugs by writing more code? I have taken on the opposite attitude. When too much code is required to solve a technical problem related to the implementation of a feature, it’s probably because there is a better way of doing it.”
Tip 3 Finally, for me, the best way to end the day is to leave the code with a failed test. It’s a bit like leaving on your desk the last file you worked on during the day. This way, the next morning, it is easy to get back into context. I am currently working with a late riser, which means he comes in later in the morning, so he leaves the office late. It is sometimes difficult to synchronize when developing in team. As we both work on the same branch, we agreed on the following strategy: the last one to leave the office finishes on a test that failed in the last commit of the day. This way, the one who comes in first in the morning can easily continue the work where it was left off. Hopefully, these 3 tips will allow you have a good night’s sleep!