Sleep More, Code More
Tags: productivity, health, career
Published: 2017-12-19 09:30:27

---
title: "Sleep More, Code More"
published: true
tags: productivity, health, career
description: Why you are more productive with more sleep.
canonical_url: http://programmergoals.com/sleep-more-code-more/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0gskxkoc38zgqrxm2tn3.png
---

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.

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 longterm successful software developer, you have to **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”](https://youtu.be/1g2ntIN7JuY) 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.

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](http://amzn.to/2C5KKJi) 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 to fall asleep or to sleep through. There are ways to fix this if you haven’t tried them yet.

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 where 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](https://www.chilitechnology.com/collections/all) Tim Ferriss recommends in&nbsp;his book&nbsp;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?

_The post [Sleep More, Code More](http://programmergoals.com/sleep-more-code-more/) appeared first on [Programmer Goals](http://programmergoals.com)._

---
### But wait, there’s more!
* Let’s connect on [Twitter](https://twitter.com/_PatrickGod), [Facebook](https://www.facebook.com/ProgrammerGoals), [YouTube](https://www.youtube.com/channel/UCq8LldVrjqe61KQttZlLW8g), [LinkedIn](https://www.linkedin.com/in/patrickgod) or here on [dev.to](https://dev.to/_patrickgod).
* Get the [5 Software Developer’s Career Hacks](http://programmergoals.com/5-software-developers-career-hacks/) for free.
* Enjoy more valuable articles for your developer life and career on [programmergoals.com](http://programmergoals.com).