Sleep More, Code More
Why a good night’s sleep leads to more and better code.
Yes, you read that right.
I know it sounds contradictory, but if you want to write more and better code, you have to sleep more.
Let me explain.
Life (and programming) is a marathon
Most of us have been there. Writing code all night and spending long hours seems cool, crunch time is great, like a LAN party with code, a hackathon, or a game jam.
Although you might produce lots of code during these events, you will need a lot of regeneration.
But let me tell you when you want to be a long-term successful software developer, you have to train for the marathon, not the sprint.
Train for the marathon, not the sprint
Programming all night long is not the marathon I’m talking about.
It’s more like the marathon of life to sound a little esoteric.
Anyway, that’s where sleep comes in.
I know it, you know it, it’s common sense. Still, we have to remind ourselves of that fact from time to time.
To keep your body and mind healthy, you need enough sleep.
Actually pretty simple.
Arnold Schwarzenegger says you should “sleep faster” and only need six hours of sleep. Some say you need eight. I guess something in between is the right amount for most of us.
And on the weekends you may be able to sleep as much as you like. I mean even longer, not shorter.
Benefits of more sleep
While enough sleep not only boosts your mood and banishes your under-eye circle, it is a key part of a healthy lifestyle and can benefit your heart, weight, mind, and more.
As a software developer, you constantly have to learn new things and remember your acquired skills. With enough sleep, you will perform better.
It’s more likely you succeed with your craft.
Not only is it easier for your brain to remember things with enough sleep, it also appears to reorganize and restructure your memories, which may result in more creativity as well.
Needless to say that with enough snoozing time you will be able to sharpen your attention and focus much better on your tasks.
You will feel less stressed, which has a positive effect on your overall mood and that in turn shows in your day-to-day life and career.
Arianna Huffington has even dedicated a whole book to sleep where she writes about the life-transforming aspects of the snooze with an impact on your workplace — all scientifically proven, of course.
Now you might already know all this and want to sleep more but simply have problems falling asleep or sleeping through.
There are ways to fix this if you haven’t tried them yet.
How to prepare for a good night’s sleep
As we are in a technical environment here, chances are you are looking at your smartphone right before you switch off the lights and go to sleep.
Try to put your phone or any other devices away a bit earlier, maybe even an hour before bedtime.
The screen keeps you awake.
Apart from that, you might try to set up a proper sleep environment or even an evening routine.
This means, pick a time when you want to prepare to go to bed. You could start by taking your shower and brushing your teeth and while you’re doing that, you already opened the windows of your bedroom so that it can cool down.
A cooler room leads to better sleep.
If that’s not enough, you can also try one of those cooling mattress toppers Tim Ferriss recommends in his book Tools of Titans (although they are pretty expensive).
When you’re done in the bathroom, make yourself a cup of tea, grab your favorite book (novels seem to work best), dim the lights, and enjoy this incredibly cozy time in your bed.
You will probably get sleepy much faster and after half an hour or so you want to turn off the lights and just sleep.
Besides, you should really leave it at the tea and not drink coffee or alcohol just before going to bed.
Alcohol may help to fall asleep, but the quality of your snooze is much worse.
Do you have any evening routines or tips to improve the quality of your good night’s sleep?
But wait, there’s more!
- ❤️ ️Let’s connect on Twitter, LinkedIn, or here on Medium.
- 📧 Subscribe to my newsletter to get early access to upcoming tutorials & online courses about .NET, Blazor & more!