DEV Community

Cover image for Want to be a better developer? Take care of your sleep!
Damien Cosset
Damien Cosset

Posted on • Updated on • Originally published at damiencosset.com

Want to be a better developer? Take care of your sleep!

Introduction

The world of today is all about productivity and speed. Everything has to be done quickly, and because there are only so much hours in the day, the first thing we sacrifice is often the same: Sleep.

This article will describe some key things you can implement in your life to improve the quality of your sleep and improve your nights. I shouldn't have to say that quality sleep is absolutely crucial. The average sleeping hours has seriously decreased over the years. And some people might even convince you that there is nothing wrong with a regular 5 hours sleep. You might even that to make it in the world. Sleep, for some, has become the enemy to productivity. Bullshit. Science says otherwise.

When you are sleep deprived, not only are you slower and less creative, you are also less efficient and accomplish less.

  • A 1997 study about surgeons found out that sleep-deprived surgeons made about 20% more errors and took about 14% longer than when rested. Sleep deprivation reduces the brain's glucose content. Grey matter uses glucose as a fuel. The decrease in glucose is even more important is parts of the brain involved in problem-solving and high-level thinking.

  • Skipping one night of sleep makes us as insulin resistant as a T2 diabetic. A drop in this hormone leads to weight gains, signs of aging and a decreased sexual drive.

So, we can't achieve peak performance without a good quality sleep. That just can't happen. Whatever good you think you are in a sleep-deprived state, that's nothing compared to how good you could be while being well-rested.

Why is sleep so important? Partly because being awake is catabolic, and sleep is anabolic.

  • Catabolism: Molecules combine with oxygen, causing them to break down.
  • Anabolism: The opposite of catabolism. It constructs molecules from smaller units.

When we sleep, our bodies are repairing themselves. You are litteraly building yourself up. Your body fights signs of aging and reinforce your immune and muscular system.

So, let's see how you can improve your sleep, feel better and increase your performances.

Light

Light is good, light is bad. To understand the effect of light on our sleep, we first need to talk about melatonin.

Melatonin is an hormone that regulates the internal body clock that tells us when to sleep. It has powerful rejuvenation and antioxydant properties. The production is heavily affected by light. Sun goes down, melatonin goes up, you feel sleepy.

You should try to maximise your light exposure during the day. People actually produce more melatonin in the evenings by being exposed to the bright lights in the morning.

Another thing you need to work on in your screen time. You probably have heard about the effect of blue light produced by screens. These blue lights actually inhibits the release of melatonin. So, 1 hours before bedtime, forget your screens.

Finally, sleep in a pitch-black room. Light is also absorbed by our skin and dark night rays also affect the production of melatonin.

Timing

Your circadian rhythm

I've mentioned your internal body clock, also called your circadian rhythm. It is important that you respect your internal clock by going to bed within 30 minutes of the same time every night. This will cause you to fall asleep and wake up a lot easier.

A lot of people go for the cut down on weekdays, catch up on weekends strategy. The truth is that completely destroys your circadian rhythm. Your body has no clue tomorrow is Sunday and it's ok to release melatonin later because we want to stay up late. It can't adapt that fast!

Early to bed, early to rise!

Then, you should go to bed and wake up early. A study makes the case for early mornings by finding out that students identified as morning students had higher academic grades than night owls. Why would that be?

We, humans, are diurnal animals. We are active during the day. We were hunter-gatherers, programmed to go to sleep at sundown because waking up at noon was not a great plan for surviving predators. For thousands of years, we have lived this way. We haven't had time to override the default settings of our species concerning our sleep.

The second reason why going to bed early is important is to take advantage of the magic sleep window between 10PM and 2AM. This is when our bodies reach their peak production of melatonin and human growth hormone. This means your sleep will be deeper and more rejuvenating during that time!

Lifestyle

Few things about your lifestyle.

Caffeine

First, your consumption of caffeine. You might know that caffeine affects your sleep, but you might not know why:

Coffee is very similar on the molecular level to adenosine. Adenosine is produced by our brain while we are awake. When it hits a certain point, we feel sleepy. Because caffeine is so close to adenosine, it goes in the receptors where the adenosine is supposed to go. The adenosine can't get into those receptors, so you don't feel tired.

As a general rule, avoid caffeine after 4PM.

Exercising

Exercising is another great way to improve your sleep. When you exercise, you create micro-tears in your muscle tissue. Those micro-tears needs to be repaired by your body. This induces the release of hormones like testosterone and human growth hormone. The repair work your body is doing creates a deeper, more restorative sleep.

Magnesium

Another cool thing you can do is use magnesium in cream form. Magnesium balances blood sugar levels, calms the nervous system and relaxes muscles. All of those things will lead to a higher quality sleep.

Note: Avoid oral supplements because most benefits will be lost during digestion.

Meditation

Finally, having a meditation routine will help you sleep better. Meditation has been proven to release feel good endorphins. It's also linked to lower stress levels.

Sleep Temple

The last part will be dedicated to your sleep Temple. To make sure you have quality sleep, a place dedicated to that activity will dramatically improve your nights.

Clean, fresh air

A bedroom with a clean and fresh air is a bedroom where quality sleep happens. Why?

In the air, there are ions, atoms with electric charges. Ions with a negative electrical charge are good because they oxidize mold, parasites and toxic chemical gases. But, over time, the air become stale as the oxygen content decreases and ions lose their negative charge.

Plants are excellent natural air filters! Plants takes carbon dioxyde and release oxygen, recharging the ions negative charges.

There are two great houseplants that you can put in your bedroom to help with that:

  • The English Ivy: Found by NASA to be the best air-filtering houseplant (Hell Yeah!), pumping out oxygen and absorbing formaldehyde, a harmful neurotoxin unfortunately too common in industrialized countries.
  • The Mother-in-law's tongue: Needs minimal water and light to flourish. Perfect for dark bedrooms 😉 Most badass thing? Converts carbon dioxyde into oxygen at NIGHT, most plants do this during the day.


Mother-in-law's tongue: the baddest bitch in the houseplant kingdom. 🤘

No-work zone

Finally, do not take work into the bedroom. This will create a spike in your cortisol level, an hormone associated with stress and wakefulness. It will also make your brain associate your bedroom with work and activity, when you want it to be associated with sleep.

Conclusion

It makes me sad, and a little bit angry, when I hear people advocating 4 hours night sleep, or presenting sleep deprivation has a must-do to be successful. Sacrificing you sleep is the first thing we will do to gain time, because it's the easiest thing to sacrifice. We think it only affects us. The reality is that it takes a toll on many things, including our relationships and our work.

Do yourself a favour, take care of yourself, take care of your sleep. It's not easy, but the rewards are worth it! So tonight, start simple and declare your bedroom a no-screen zone and bring a good old paper book 😉

Have fun ❤️

Sources:

Top comments (27)

Collapse
 
spqrbob profile image
Bob McCann • Edited

Damien,

Your article resonated with me and my struggles with sleep. I struggle daily with physical fatigue, poor mental focus and concentration, and difficulties with memory. My sleep hygiene is terrible. I stay up far too late, and then when I do come to bed, the first thing I do when I get under the covers is grab my cell phone and browse Reddit for 30 to 60 minutes. I have a CPAP machine, but I only use it about half the time, and my wife usually is watching TV when I am trying to go to sleep. It is a wonder if I get any sleep at all.

At work, I am tired, and my thoughts are scattered. I have trouble staying focused on a task until it is completed, and at the end of the day, I am often left wondering what exactly did I accomplish today? I also go the school part-time with classes in the morning. By the time I leave work, stop by the store, finally get home and have dinner, I am so exhausted that any homework I have been assigned seems like too much to deal with. My grades have suffered.

I have thought all of this was signs of getting older, and perhaps the result of some medical issue causing my chronic fatigue. We have done sleep studies and I have tried medications, I have the aforementioned CPAP machine, and none of it helps me. On the positive side, I quit drinking carbonated beverages several months ago, and the only caffeine I normally take is in the form of pills, which I take in the mornings and early afternoon. What I haven't done yet is all of the other things you talk about in your essay.

I am going to try to do what you have suggested in this article for the next 30 days: I will endeavor to get to bed earlier and rise earlier as well. I am not going to ask my wife to not watch TV at night, but I do have earplugs and a sleep mask to keep out the noise and light. The only thing I will use my cellphone for in bed will be to make sure my alarm is set for the proper time for the following morning. I will be loyal to my CPAP, and use it faithfully every night. I will endeavor to use my newfound energy in the morning hours to begin a program of light exercise, such as walking with my wife. I might even start a more strenuous exercise routine later in the day in the gym at my workplace. I may or may not be able to go forward with the magnesium cream and houseplants at the outset, but may be able to later.

Let's see how my 30-day experiment goes! Perhaps I will make a profound discovery that will allow me to regenerate myself and find a well of energy, focus, and concentration that I never thought possible anymore. Maybe I'll just get some good sleep. Whatever the outcome, I know what you suggest is far healthier than my current sleep behavior. Wish me luck!

Collapse
 
smartcodinghub profile image
Oscar

Don't forget to do an update with your results and thought. I have the same problem. Good luck!

Collapse
 
damcosset profile image
Damien Cosset

Good luck my friend 💪

Collapse
 
murkrage profile image
Mike Ekkel

A great read! I'll be the first to admit my sleeping schedule is all kinds of messed up. I'm trying to get back into a proper rhythm but it's incredibly hard. I have a hard time getting to feel sleepy, if that makes sense? If I go to bed without feeling sleepy, even if I don't turn on any screens, I'll stay awake for a good 2 hours. I just won't fall asleep. It's tough and I often find myself opening Twitter or something like that to keep me occupied. I'll eventually fall asleep, though. I guess the first thing I can do is make my bedroom a no-screen zone, that'll probably help me out a lot.

Collapse
 
damcosset profile image
Damien Cosset

Your sleep cycle was most certainly affected by the screens ;)

The no-screen zone is a must in my opinion ( and gosh it's hard... ). I would also suggest, if possible, to spend some time outside before 8:30 AM. Bright lights exposure help the release of melatonin in the evenings. That could help you fell sleepy ;)

Best of luck!

Collapse
 
murkrage profile image
Mike Ekkel

AM or PM? Because I am definitely outside before 8:30 AM :). Starting Monday I'm also going to get into some form of exercise schedule. Back when I still did some sort of sport on a regular basis, I noticed I slept like a baby. So I am definitely taking that advice with me! Going out at night, while it's still light out, will probably help my mental state as well. Plus, it gives me a chance to just stroll around the city with my partner every day :)

Thanks for this post, it was a great read and really motivates me to get into a better sleeping rhythm!

Thread Thread
 
damcosset profile image
Damien Cosset

That's AM ;)

Exercising, exposure to light during the mornings, that will definitely help you a lot!

Thread Thread
 
murkrage profile image
Mike Ekkel

I will keep that in mind :)

Collapse
 
karlredman profile image
Karl N. Redman

Please add tag #mentalhealth

good stuffs.

Some of this is not exact science (i.e. scientists just revealed XXX about coffee blah, blah [specifically, coffee drinkers live longer -but that just might be the daily wine I'm drinking doing the talking :P].

I think what you're preaching is balance (IMHO). And that's fantastic relative to the info you present here.

Collapse
 
damcosset profile image
Damien Cosset

Thank you.

About coffee, just avoiding it close to bedtime is enough ( I believe it lasts 8 hours in your system or something like that ). I'm personally not going to give my daily cups of coffee :D I'm just making sure to not drink any after 4PM ;)

And I agree about the balance. I can understand that sleep is sacrificed at some point. We all have busy lives, with a lot of people counting on us. Cutting down on sleep is the easiest thing to do. I have been doing it, and will most likely do it again at some point in the future unfortunately. As long as it's a short-term thing.

What really pisses me off though is people preaching that you NEED a 4-5 hours sleep per night if you want to make it. That kind of war on sleep makes me sick.

Collapse
 
karlredman profile image
Karl N. Redman

heh, about coffee (further).... it's something people add to their systems. Everything we add into our bodies is part of the overall "chemical game" that we play overall -sugar, meat, etc. And this all affects everything we do -not just sleep.

I joked around with my comment relative to science but the one thing that is consistently reported for health/mental-health is the need for sleep and a sleep regiment. I'm terrible at this also; regardless of my daily routine.

Likewise, but maybe that's just bravado(?). I feel that I work best working 10 hour stints over a 30 hour period and sleeping 12 hours after that (with cat naps in between). Obviously I can't sustain that and also do a 9-5. And in that respect I think the make it perspective comes from the context of 'how to make it to daily corporate meetings and such (broadly speaking). That need aspect is foreign to me (with my 'i'll sleep when i'm dead' attitude). But maybe we're the fools(?).

Another thing:
I've experienced a fair amount of PTSD things that cause sleep issues. [I'm using myself as an example here]. I think make it is relative to what your mind has tolerance for in terms of downtime. In my situation, I think(?) my mind/muscle-memory/etc. only allows for 4-5 hours of sleep at a time; which makes things tricky for jobs and stuff.

Like I said: I like your article. It's a subject that is dear to me and I think it's really an important topic -and often a neglected subject matter.

Lastly, I apologize for not adding sources for my comments. I can do so if pressed.

Cheers!

Thread Thread
 
damcosset profile image
Damien Cosset

That need aspect is foreign to me (with my 'i'll sleep when i'm dead' attitude). But maybe we're the fools(?).

I sure hope not :D

I completely understand, and agree, that every one is going to have different circumstances and preferences on how they approach their relationship to sleep. The 8 hours sleep might be a luxury that only some can have. I don't have kids yet, so maybe I will change my speech later :D

As for the sources, if you feel like they could contribute to the article, I would be more than happy to add them in the sources for this article. Having another point of view and a different pair of eyes on the subject can't hurt.

Collapse
 
vimmer9 profile image
Damir Franusic

First or all, It's a great article and I haven't finished it but have, on the others hand, saved it for later. The funny thing is, when you're younger you feel invincible and don't pay attention to your sleeping habits.

I belive this is especially prominent in software development community or maybe it's IT in general. I felt the need to comment since I've been doing dev for around 20 years, started when I was 16.

In the old days, I would sleep maybe 2 to 4 hours a day, and would stress myself to the point of almost collapsing.

After weeks of this torture, my body finally decided to put a stop to all this in a form of grand mall epileptic seizure. And there you have it.

If I hadn't been so reckless about my own health, my daily routine would not include taking two types of pills twice a day.

This is just my unfortunate experience and it doesn't happen to everyone but it could happen to you if you're not careful. Times have also changed, for the worse of course; now it's even more stressful and people are pushed to work even harder.

Go to bed before 2am, get at least 6 hours of sleep, it will increase your productivity and maybe spare you of any potential health issues.

Cheers,
DF

Collapse
 
jnasoy profile image
Joseph Nash Belandres

Great article. I usually only get an average of 5 hours of sleep and I don't feel productive even though i have more available time (technically) to do work. I feel like I am always dreaming up to the point i cannot recognize reality anymore (you know what i mean? Hehe). Thanks for the advice i will try to get as much sleep as I can starting today. It all boils down having self dicipline

Collapse
 
garrett profile image
Garrett / G66 / megabyteGhost

I definitely sleep more than I should, but I think some of that is because my sleep isn’t optimized.

I especially need to work on the dark room. I live in an apartment and there’s a light right outside my bedroom window. I didn’t know that the light affected us through our skin. I got a sleep mask because I thought it only affected us through our eyes. I’ll need to get blackout curtains.

Collapse
 
tdfranklinaz profile image
Trevor Franklin

I've had a huge issue with sleep when I first started working at a digital agency. I got into a bad loop where I was only getting 4 hours every night for months at a time and it was effecting my performance on the job.

My solution worked really well: Turn off all electronics after 10:00 PM and initiate my nightly routine. Shower, writing in my journal to reflect and get all my thoughts out before getting into bed and reading until I pass out. My sleep just about doubled and I started waking up feeling amazing!

Before I started using this routine I was waking up feeling like crap and I had already failed my day before it started. I would encourage everyone to get enough sleep and wake up as early as possible.

"early to bed & early to rise makes a man wealthy and wise"

Collapse
 
omerxx profile image
Omer Hamerman

Fantastic piece. Sleep is important to everyone not only developers.
Sleeping enough is ground for clear mind which is able to think process and create. When we’re creative we’re also productive and more importantly HAPPY.

Collapse
 
petarov profile image
Petar G. Petrov • Edited

We were hunter-gatherers, programmed to go to sleep at sundown because waking up at noon was not a great plan for surviving predators. For thousands of years, we have lived this way. We haven't had time to override the default settings of our species concerning our sleep.

Perhaps something interesting about this is that being active only during the day and having an 8 hour sleep in the night seems to be more of an industrial age thing, rather than the way we've been living for thousands of years.

Some studies and old literature suggest that people before the industrial age practiced something called the interrupted sleep which consisted of 1st and 2nd sleep. The pause in between was used for people to pray, socialize, even visit neighbours and so on. More about this in The myth of the eight-hour sleep

Other than that, I completely agree with you that blue light is an enemy of good sleep and going to bed at around 10 PM definitely makes a difference!

Collapse
 
damcosset profile image
Damien Cosset

Interesting read. It would seem that we started playing with our sleep cycles earlier than I thought.

Collapse
 
veebuv profile image
Vaibhav Namburi

The toughest truths I need to accept. I'm horrible with my sleep and I know it affects my concentration immensely. I NEED to fix this habit and couple it with exercise!

Great read mate! Very important topic

Collapse
 
shreyasht profile image
Shreyash

One of the best article I have read on Dev!

Whatever you do, if you are not well rested, your performance would be sub-optimal.

Some more factors that affect performance are:
1) Diet: Eating too much sugar or carbs around bedtime causes issues with sleep. Also, in general, if you are not watching what you eat then you are not doing justice to your body.
2) Stress: There is no other worst enemy than stress. If you are stressed out, your hormones would go haywire.
3) Not taking a break from the routine: A monotonous routine is something that really breaks you.

Collapse
 
damcosset profile image
Damien Cosset

Amen to that!

Collapse
 
kienngo profile image
ken

Agree with the Mother-in-law tongue. In my country they're called "Tiger's tongue" or "Snake's skin" :)

Collapse
 
inigogb profile image
BaronVonHex

Thx bro, I've been neglecting my sleep lately due to heavy workload. Going straight to bed before damaging my health. Time to count some electrical sheep.

Collapse
 
mihirpa98294668 profile image
mihir patel • Edited

Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.kodlogs.net/562/how-to-get-quality...

Collapse
 
damcosset profile image
Damien Cosset

We've all been there 😉.