Prioritize your Sleep

Want to be effective? What to become better at anything? Prioritize your sleep, no matter what. Sleep deprivation is bad on all counts. End of story.

Sleep deprivation can be our own doing: we lead busy lives and stay up too late instead of calling it a night when we should, or we think that we can adapt to needing less sleep. But often, sleep deprivation goes hand-in-hand with overwork.

If you care about your effectiveness – as a human, a software developer, an engineer, a decision maker, a leader – you should prioritize proper sleep and ward off all attempts to get you to work long hours.

Note

Of course, sometimes you have a good reason to have a late night – such as staying up and reconnecting with a friend you haven’t seen in a while. It’s going to happen and you shouldn’t miss opportunities like that. But don’t expect yourself to be as effective the next day if you’re sleep deprived, don’t make it a habit, and don’t sacrifice sleep on behalf of getting work done.

Table of Contents:

  1. Impacts on Mental Work (i.e., Software Development)
  2. Economic Impacts
  3. References
  4. Future Reading

Physiological Impacts of Fatigue and Lack of Sleep

  • Lack of sleep is associated with reduced blood flow in several regions of the brain, as well as changes in body temperature
  • Lack of sleep negatively impacts working memory, creativity, decision making, multitasking ability, response time, and focus
  • Lack of sleep hinders memory formation processes in the brain
  • Performance for tasks that require attention declines as a function of hours of sleep deprivation.
  • You’ll start experiencing microsleeps (very short periods of sleep-like state), which decreases your cognitive performance
  • Sleep deprivation negatively affects the reactivity to stimuli from emotions – you’re more irritable and reactive
  • Lack of sleep is linked to health problems like high blood pressure and even early death
  • Note that the ability to perform complex mental tasks degrades faster than physical performance does. Col. Gregory Belenky noted in his studies on continuous operations that “In contrast to complex mental performance, simple psychomotor performance, physical strength and endurance are unaffected by sleep deprivation.”

Impacts on Mental Work (i.e., Software Development)

Practically speaking, sleep deprived coding is a great way to write bad code. You’re going to introduce more errors than you would if you were well-rested, take longer to accomplish your tasks (often due to the errors you’ve introduced, but also because of difficulty focusing), and likely introduce problems you have to fix in the future.

  • The negative impacts on working memory affect your ability to solve problems, pay attention, and make decisions. This happens with even 1-2 hours of insufficient sleep per night.
  • Col. Gregory Belenky was studying continuous combat operations and noted that mental work declined at a rate of 25% per successive 24 hours of continuous wakefulness. He also noted that speed declines as wakefulness is extended. These effects are not dependent upon all-nighters, either: in one scenario, 15 days into operations, an artillery battery with 4 hours sleep/night fired less than 1/3 of the rounds that the 7 hour sleep/night battery fired.
  • Col. Belenky also pointed out that the consequences of losing as little as one hour of sleep per night include reduced higher-order mental abilities that sustain situational awareness, reduced individual effectiveness, reduced unit effectiveness, and an increase in errors and accidents.
  • Even just one night of sleep deprivation is detrimental to software developers; as [Fucci et al.] found, sleep-deprived developers produce software of lower quality (which they define as functional correctness), make syntactic mistakes at a higher rate, and find that even simple actions become difficult in a sleep deprived state
  • Sakar and Parnin found that fatigued developers have problems focusing, coming up with optimal solutions, and tend to make logical mistakes which cause bugs. Fatigue reduced creativity and motivation.
  • Being awake for 21 hours impairs drivers as much as having a blood-alcohol concentration of 0.08

Economic Impacts

The estimated economic impacts of sleep deprivation in workers in the U.S.: $63.2 billion (and 252.7 workdays) per year.

References

  • Why Crunch Mode Doesn’t Work: 6 Lessons by Evan Robinson

    In the short term, working over 21 hours continuously is equivalent to being legally drunk. Longer periods of continuous work drastically reduce cognitive function and increase the chance of catastrophic error. In both the short- and long-term, reducing sleep hours as little as one hour nightly can result in a severe decrease in cognitive ability, sometimes without workers perceiving the decrease.

  • Need for Sleep: The Impact of a Night of Sleep Deprivation on Novice Developers’ Performance by Davide Fucci, Giuseppe Scanniello, Simone Romano, Natalia Juristo
    • Abstract:

      We present a quasi-experiment to investigate whether, and to what extent, sleep deprivation impacts the performance of novice software developers using the agile practice of test-first development (TFD). We recruited 45 undergraduates, and asked them to tackle a programming task. Among the participants, 23 agreed to stay awake the night before carrying out the task, while 22 slept normally. We analyzed the quality (i.e., the functional correctness) of the implementations delivered by the participants in both groups, their engagement in writing source code (i.e., the amount of activities performed in the IDE while tackling the programming task) and ability to apply TFD (i.e., the extent to which a participant is able to apply this practice). By comparing the two groups of participants, we found that a single night of sleep deprivation leads to a reduction of 50 percent in the quality of the implementations. There is notable evidence that the developers’ engagement and their prowess to apply TFD are negatively impacted. Our results also show that sleep-deprived developers make more fixes to syntactic mistakes in the source code. We conclude that sleep deprivation has possibly disruptive effects on software development activities. The results open opportunities for improving developers’ performance by integrating the study of sleep with other psycho-physiological factors in which the software engineering research community has recently taken an interest in.

    The importance of sleep is nowadays recognized in the field of economics, where it is shown that sleep disturbances contribute to decreased the employees’ performances at a high cost for the employers. In management science, sleep loss was found to bewilder decision-makers activities.

    In general, the lack of sleep affects working memory, creativity, decision making, multitasking ability, response time, and focus. Not getting enough sleep prevents the brain from restoring its effectiveness, as it needs to work harder to accomplish the same amount of work. In particular, the performance for tasks that require attention declines as a function of hours of sleep deprivation.

    Comparing the two groups of participants, we found that:

    • the quality of the software measured as functional-correctness produced by sleep-deprived software developers drop by half compared to developers under normal-sleep condition;
    • sleep deprivation can have an impact on the engagement of developers, as well as their ability to follow the TFD practice.

    Sarkar and Parnin analyzed mental fatigue of software developers. They surveyed 311 software developers and carried out an observational study with nine professionals. Their results show that fatigued developers have problems in focusing, coming up with optimal solutions and tend to make logical mistakes causing bugs. Moreover, fatigue hampered developers’ creativity and motivation. They reported that one of the leading cause of mental fatigue for software developers is sleepiness.

    Medical research has shown that sleep deprivation decreases cognitive performance because of the wake-state instability due to microsleeps—i.e., very short periods of sleep-like state. Moreover, sleep deprivation negatively affects the reactivity to stimuli from emotions. The non-medical scientific communities studied the effects of sleep deprivation mainly in the field of manufacturing and decision making , but not in the software engineering field. Sleep deprivation has detrimental effects on central features necessary for software development, such as working memory— that part of short-term memory in charge of manipulating transient information, which is fundamental for problem solving, attention, and decision making. Table 1 reports the main effects of sleep deprivation on cognitive performances that can have consequences for software development.

    RQ1. Does sleep deprivation decrease the quality of the solution to a programming task?
    Since we were able to reject H0QLTY we answer RQ1 as follows: developers who forewent one night of sleep write code which is approximately 50% more likely to not fulfill the specification with respect to the code written by developers under normal sleep condition. […] In our additional analysis, we showed that sleep-deprived developers are more prone to perform editing actions to address syntax issues and, from preliminary qualitative evidence, that even simple operations can become difficult under such condition

    RQ2. Does sleep deprivation decrease the developers’ activeness in writing source code?
    Although the results are not conclusive, we have evidence that one night of sleep deprivation can be harmful to the developers’ activeness, with a loss of about 43% reported in this study.

    The main take-away from our quasi-experiment can be summarized as follows:

    One night of sleep deprivation is detrimental for software developers. In particular, sleep-deprived developers produce software of lower quality (i.e., functional correctness).

  • Never Work in Theory: The Impact of Sleep Deprivation

    By comparing those who slept with those who didn’t, they found that a single sleepless night reduced code quality by 50%. This is consistent with what we know from a century of other studies (see here for a short summary, and here for a shorter one); I don’t expect companies or universities will suddenly start paying attention to the evidence, but perhaps now that so many of us are working from home it will be easier for us to take naps when we need them.

  • The High Cost of Bad Sleep: $63 Billion Per Year

    Lack of sleep has been linked to health problems like high blood pressure and even early death, and now a new study tallies another price: insomnia costs the average American worker 11.3 days, or $2,280 in lost productivity each year. That adds up to $63.2 billion (and 252.7 workdays) for the whole country.

    “It’s an underappreciated problem. Americans are not missing work because of insomnia,” said lead author Ronald C. Kessler in a statement. “They are still going to their jobs but accomplishing less because they’re tired. In an information-based economy, it’s difficult to find a condition that has a greater effect on productivity.”

  • Why Crunch Mode Doesn’t Work: 6 Lessons by Evan Robinson

    Lesson Five is this: Continuous work reduces cognitive function 25% for every 24 hours. Multiple consecutive overnighters have a severe cumulative effect.

    Programmers, artists, and testers aren’t paid for their bulging muscles and phenomenal ability to move mass from point A to point B. They’re paid for their brains. Longer hours or, especially, insufficient sleep (as little as 1-2 hours less per night) does serious damage to their ability to use those brains productively.

    Lesson Six is this: Error rates climb with hours worked and especially with loss of sleep. Eventually the odds catch up with you, and catastrophe occurs. When schedules are tight and budgets are big, is this a risk you can really afford to take?

    The ability to do complex mental tasks degrades faster than physical performance does. Among knowledge workers, the productivity loss due to excessive hours may begin sooner and be greater than it is among soldiers, because our work is more affected by mental fatigue.

  • Sustained Reduced Sleep Can have Serious Consequences, Linda Cook, NINR, March 2003.

    In a study on the effects of sleep deprivation, investigators at the University of Pennsylvania found that subjects who slept four to six hours a night for fourteen consecutive nights showed significant deficits in cognitive performance equivalent to going without sleep for up to three days in a row. Yet these subjects reported feeling only slightly sleepy and were unaware of how impaired they were.

    Reduced cognitive abilities can occur even with a moderate reduction in sleep.

    Dr. Patricia A. Grady, Director of the National Institute of Nursing Research, NIH, which provided primary funding for the study, said, “These findings show that while young adults may believe they can adapt to less than a full night’s sleep over time, chronic sleep deprivation may seriously affect their performance while they are awake, and they may not even realize it.”

  • Sleep, Sleep Deprivation, and Human Performance in Continuous Operations by COL Gregory Belenky

    Laboratory studies show that mental work declines by 25% during each successive 24 hours of continuous wakefulness. Sleep-deprived individuals are able to maintain accuracy on cognitive tasks, but speed declines as wakefulness is extended.
    […]
    In our study, FDC [artillery Fire Direction Center — ER] teams from the 82nd Airborne division were tested during simulated continuous combat operations lasting 36 hours. Throughout the 36 hours, their ability to accurately derive range, bearing, elevation, and charge was unimpaired. However, after circa 24 hours they … no longer knew where they were relative to friendly and enemy units. They no longer knew what they were firing at. Early in the simulation, when we called for simulated fire on a hospital, etc., the team would check the situation map, appreciate the nature of the target, and refuse the request. Later on in the simulation … they would fire without hesitation regardless of the nature of the target.
    […]
    At 15 days into the simulation the 4 hour sleep/night battery is firing less than a third of the rounds that the 7 hour sleep/night battery is firing.

    The consequence of not getting adequate sleep is reduced mental abilities, specifically the higher order mental abilities that sustain situational awareness and tactical grasp. The consequences are reduced individual and unit effectiveness, errors, accidents, increased casualties from enemy action, and friendly fire incidents. These affect the outcome of the immediate operation and may degrade the soldiers’ abilities to sustain effectiveness in future operations and subsequently to lead a full and fulfilling life.

    In contrast to complex mental performance, simple psychomotor performance, physical strength and endurance are unaffected by sleep deprivation.

  • Sleepy Medical Interns Called a Road Hazard by Karen Kaplan, January 13, 2005

    Studies have shown that being awake for 21 hours impairs drivers as much as having a blood-alcohol concentration of 0.08, which is the legal limit for noncommercial drivers in the U.S.

  • The Promise of Sleep by Dr. William Dement, pp 51-53

    The night of March 24, 1989 was cold and calm, the air crystalline, as the giant Exxon Valdez oil tanker pulled out of Valdez, Alaska, into the tranquil waters of Prince William Sound. In these clearest of possible conditions the ship made a planned turn out of the shipping channel and didn’t turn back in time. The huge tanker ran aground, spilling millions of gallons of crude oil into the sound. … In its final report, the National Transportation Safety Board (NTSB) found that sleep deprivation and sleep debt were direct causes of the accident. … The direct cause of America’s worst oil spill was the behavior of the third mate, who had slept only 6 hours in the previous 48 and was severely sleep deprived.

Future Reading

  • Y. Harrison and J. A. Horne, “One night of sleep loss impairs innovative thinking and flexible decision making,” Organizational behavior and human decision processes, vol. 78, no. 2, pp. 128– 145, 1999.
  • L. Linde and M. Bergströme, “The effect of one night without sleep on problem-solving and immediate recall,” Psychological research, vol. 54, no. 2, pp. 127–136, 1992.
  • P. Alhola and P. Polo-Kantola, “Sleep deprivation: Impact on cognitive performance,” Neuropsychiatric disease and treatment, vol. 3, no. 5, p. 553, 2007.
  • M. Thomas, H. Sing, G. Belenky, H. Holcomb, H. Mayberg, R. Dannals, J. Wagner, D. Thorne, K. Popp, L. Rowland et al., “Neural basis of alertness and cognitive performance impairments during sleepiness. i. effects of 24 h of sleep deprivation on waking human regional brain activity,” Journal of sleep research, vol. 9, no. 4, pp. 335–352, 2000.
  • S. Sarkar and C. Parnin, “Characterizing and predicting mental fatigue during programming tasks,” in Proceedings of the 2nd International Workshop on Emotion Awareness in Software Engineering. IEEE Press, 2017, pp. 32–37.
  • J. S. Durmer and D. F. Dinges, “Neurocognitive consequences of sleep deprivation,” in Seminars in neurology, vol. 25, no. 01. Copyright⃝c 2005 by Thieme Medical Publishers, Inc., 333 Seventh Avenue, New York, NY 10001, USA., 2005, pp. 117–129.
  • J. J. Pilcher, C. Callan, and J. L. Posey, “Sleep deprivation affects reactivity to positive but not negative stimuli,” Journal of psycho- somatic research, vol. 79, no. 6, pp. 657–662, 2015.
  • Y. Harrison and J. A. Horne, “The impact of sleep deprivation on decision making: a review.” Journal of experimental psychology: Applied, vol. 6, no. 3, p. 236, 2000.
  • G. R. Bergersen and J.-E. Gustafsson, “Programming skill, knowledge, and working memory among professional software developers from an investment theory perspective,” Journal of Individual Differences, 2011.
  • S. Vidaček, L. Kaliterna, B. Radošević-Vidaček, and S. Folkard, “Productivity on a weekly rotating shift system: circadian adjustment and sleep deprivation effects?” Ergonomics, vol. 29, no. 12, pp. 1583–1590, 1986.

Share Your Thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.