In the development community, talks about creating productive environments many times focus on workflows and development tools. Writing code is only part of the equation! Our ability to get in the right mindset and the efficiency at which we write code play a large part in delivering quality projects and solutions. Many factors play into this, from our sleep schedules, diets, activity levels, time scheduling and ability to prioritize, to the space we work in, our desk setups, and the resources we utilize. Throughout this series, we’ll touch on those aspects of creating a productive environment, starting with sleep, the foundation that will allow us to do everything else more effectively.
When people think about developers, one thing that comes to mind is that we don’t sleep at night. Many of us have weird schedules fueled by caffeine that stretch into the wee hours of the morning. It feels like we’re doing the right thing, grinding out code until our problems are solved, or until our brains shut down, whichever comes first. In the long-term, this kind of lifestyle isn’t sustainable and can lead to diminishing performance, burnout and health issues. We treat sleep like an enemy that gets between us and our code, but sleep is good!
Benefits of sleep
The positive effects of getting a proper sleep are so numerous that they far outweigh the diminishing returns of working longer and the negative health effects associated with sleep deficits and abnormal sleep cycles.
- Increased memory, attention and focus – Being able to remember more means less switching between screens to look things up. It also makes you less likely to forget anniversaries or your spouses birthday. Life gets hard when that happens. Don’t do that. The ability to fully concentrate on the problem at hand will make you more efficient, and at a certain point increased efficiency outweighs throwing more time at problems. We don’t like brute force approaches in our algorithms, and brute force approaches aren’t acceptable here either.
- Longer life – Productivity drops to zero if you’re dead.
- Lower stress – When we’re stressed, our cortisol levels rise. Raised cortisol levels will break down our lean muscle mass, increase weight gain, negatively affect our immune systems over time, and also affect memory.
- Decreased dependence on stimulants – There was a time when a cup of coffee would get me wired. Now it takes many, and you may be in a similar situation. It’s simply more efficient if we can get the same results from one or two cups of coffee rather than 6 or 7. By supplementing those extra cups of coffee with sleep (and a well balanced diet), we come out ahead. Our baseline efficiency will be higher with proper sleep, and at that point a caffeinated beverage can enhance what’s already there, rather than trying to replace it.
So why do we work at night?
In Swizec Teller’s article, Why programmers work at night, he essentially posits that:
Programmers are shoving entire complete systems into our brain, similar to building a house of cards. When we get distracted, it comes crumbling down. We end up on night schedules because we get interrupted throughout the day, which prevents us from making progress on the complex projects we work on. At night, we get a continuous block of time where gears can start turning and remain in motion until a solution is reached.
I’ve found myself on this schedule, which Paul Graham refers to as the Makers Schedule, and while this is certainly a way to get work done, it’s not without its costs.
“Breaking the rhythm of your daily routine has consequences.” –Eat Move Sleep by Tom Rath
“Switching over to daylight saving time, and losing one hour of sleep, raised the risk of having a heart attack the following Monday by 25 percent” – Reuters
If just a one hour change can cause such a drastic increase in heart attacks, imagine what we’re doing to our own bodies if we’re constantly throwing our sleep cycles out of whack when we work late or pull an all-nighter? Aside from heart attacks, when we throw off our circadian rhythm and run on less than a full night of sleep, our hormones get wonky and glucose regulation is also affected. Weight gains, mood changes, cancers and diabetes are all possible results to being subjected to sleep deprivation over an extended period of time.
As we’ve seen, drastic shifts are hardly ever beneficial, so if you’re going to bed 5 hours later than you should, I don’t recommend trying to go to bed 5 hours earlier tonight. With New Years resolutions, most of us tend to fail because we try to make large changes in short periods of time and those changes are just too big to stick. The way to make any lasting change happen is by making small incremental changes that eventually get us to our goal. By trying to go to bed 15 minutes earlier each night, over the course of a month, most people will probably get to where they’d like to be, and by setting that daily goal to only 15 minutes, we’re setting goals that are achievable.
Our Screens Aren’t Helping
Computer screens emit blue light. Do you know what else emits blue light? That’s right, the sun!
Our bodies interpret the input of this short wavelength light as it being day time. If we’re staring at screens late into the night, we’ll have more trouble sleeping.
“reading on a tablet for a couple hours before bed may find that their sleep is delayed by about an hour.” –Research on justgetflux.com
Back when I was living in an underground apartment in Brooklyn with one window, which was below street level, I started using Flux. It gave me some kind of idea of whether it was day or night out in the world. Flux is an app that will shift your screen towards the red end of the spectrum. It has a number of settings for simulating the sunset and taking timezones and such into consideration. The idea is that with the blue end of the spectrum suppressed, our bodies won’t think it’s still daytime, and we’ll have less trouble falling asleep from staring at our screens at night. Unless you’re doing photo editing at night, give it a try.
I don’t know about you, but in the past I’d tend to fall asleep with my phone, which as you can guess by now, also emits blue light. My nightly routine would consist of reading NextDraft, Wikipedia, and if I’m still awake, the Kindle app.Unfortunately, Flux isn’t on iOS (Update: iOS 9.3 will be releasing with a feature called Night Shift that will do the same thing!), but Kindle has different color modes, so it can be set to have a black background. Even so, my best recommendation is keep the phone out of the bedroom, or at least leave it on a night table. Aside from not having our sleep delayed due to the blue light from the screen, that time spent reading articles we probably don’t care about anyway will be much more effective if it’s converted to sleep instead.
Go To Bed
Now we’ve touched on a few of the many aspects that make sleep important and vital to our success, as well as a couple of ways to help us get on a good sleep schedule. The next important part, which conveniently ties in to sleep, is waking up and having a productive start to our days! We’ll be covering productive mornings tomorrow, keep coming back for the rest of this series throughout the week.
Want to learn more about sleep? I just found this video before publishing this post, and it covers many of the topics addressed above: