Cognitive Function

Authors: Gabriel Case, Software Developer and Sheeva Azma, Cognitive Neuroscientist

Cognitive Function: A Key Human Factor in Software Development and DevOps

Human cognitive factors are a crucial aspect of software development and DevOps. Coding and distributed systems engineering are applied forms of abstract thinking and complex problem-solving. When our mental faculties are compromised, the human mind transforms from a great asset into a dangerous liability: one that churns out bugs, security problems, system failures, and poor customer experiences.

When designing a system or tool to increase productivity, we should strive for a great interaction experience for both the engineers creating and running the system, as well as the users that the system serves. A basic understanding of cognitive function and knowledge of factors that influence cognitive performance will assist us in designing and building better systems, tools, and experiences for both engineers and users.


Table of contents:

Cognitive Functioning

Cognitive functioning, sometimes referred to as cognitive performance, plays a significant, though under-appreciated, role as a human factor in software engineering. Cognitive function refers to the full suite of mental abilities that humans use every day. Learning, thinking, reasoning, decision-making, remembering, and attention are all facets of cognitive ability 12. Dr. Trevor Robbins of Cambridge University defines cognition as “the ultimate function of the brain” 3.

Cognitive functioning can be affected by stress, anxiety, and insomnia. Even working very long hours can negatively affect cognitive functioning – which is, unfortunately, common in software development and DevOps.

The link between mind and body is very well-established. What one does with their physical body directly affects the mind. How much we sleep, what we eat, whether we exercise or not, and even our posture can affect our mental state. Perhaps it should go without saying, but cognitive function can directly be influenced by our physical state. If we are tired, stressed out, anxious or depressed, these mental states can affect our daily functioning and physical health.

One critical aspect of cognitive function is executive function. Executive function includes mental control, self-regulation, and the brain’s ability to sort and process information. Examples of executive functions include “mentally playing with ideas; taking the time to think before acting; meeting novel, unanticipated challenges; resisting temptations; and staying focused” 4. Executive function is a crucial aspect of cognitive function for a software engineer, who will often grapple with complex systems and abstractions while trying to make optimal decisions regarding their implementation. When mistakes are made during this process, the effects can be catastrophic. Anything that impairs executive function, therefore, increases the likelihood of such disastrous mistakes.

Sleep, Circadian Rhythm, and Cognition

Sleep has an important role in cognitive function. Sleep is restorative for a number of the body’s systems including memory, immune function, and even metabolism. Sleep deficits can impair cognitive function, affecting our ability to think, remember, and make decisions. In fact, a study has shown that sleep deprivation for extended periods of time – 17 to 19 hours – results in functional impairments equivalent to a blood alcohol concentration (BAC) of 0.05 percent 5. After longer periods without sleep, the study found that participants’ performance on cognitive and motor tasks became equivalent to a BAC of 0.1%, which is about five or six drinks.

In order to have optimal cognitive functioning, including optimal executive function, one must make sure to obtain enough high-quality and uninterrupted sleep each night. The National Sleep Foundation recommends that adults sleep seven to nine hours each night. People who work night shifts should ensure that they can obtain uninterrupted sleep during the day, or should endeavor to take regular naps to make up their sleep deficit.

Highly respected software developer John Carmack, creator of DOOM and Quake, always emphasized the importance of sleep to his productivity:

I have known a few people that function well with little sleep, but I’m not one of them. Losing an hour of sleep impacts my work significantly. 6

I often worked nights and slept during the day, but I almost always got 8 hours of sleep. There are still 112 hours left in the week! 7 - John Carmack

Your circadian rhythm, also known as the sleep-wake cycle, is an important part of sleep 8. The circadian rhythm is an internal clock in your brain that adjusts your sleeping patterns to the natural light-dark cycles of the Earth. The circadian rhythm functions optimally when you get regular sleep.

An engineer who sleeps around 11 pm and wakes up around 7 am every day takes advantage of the sun’s natural light-dark cycle to help them stay consistent. Because highly variable sleep schedules can be a source of stress and anxiety, this person also improves their cognitive functioning by sleeping the recommended eight hours a night and by having a consistent sleep/wake cycle.

On the other hand, an engineer who stays up all night and wakes up at different times during the day will suffer. An engineer who lacks a consistent sleep/wake cycle will sleep a variable number of hours each night, and may sleep less than the ideal minimum. The inconsistency of such a sleep schedule also serves as a stressor for the body and mind, increasing an engineers risk of anxiety and/or depression.

The blue light emitted by computers and smartphones “trick” your brain into thinking it’s daytime – and are known to make falling asleep at night more difficult. Avoid exposure to these lights for two to three hours before sleeping, or enable “Night Mode” on your devices. “Night Mode” is the mode that automatically tunes the brightness and color of your screen to match the sunrise and sunset. The name of this mode may vary depending upon your device.

Inconsistent sleep schedules impair cognitive functioning by disrupting circadian rhythms. When working environments are not designed with circadian rhythms in mind, the consequences can be disastrous. In 2017, two fatal collisions killed 17 crew members of the U.S. Navy Pacific Fleet.

collision

Two major contributing factors to the collisions were inconsistent sleeping schedules and insufficient rest 9.

After these tragic incidents, the Navy recognized the importance of human factors and specifically cognitive factors, such as circadian rhythms, in sailors’ daily functioning. In response to this disaster, the Navy changed its rules regarding the length of continuous duty for sailors working on aircraft carriers, prohibiting them from working for more than 18 hours in a row. These requirements were previously only applied to flight crews on the aircraft carriers. What’s more, the Navy shifted to a circadian rhythm-based schedule, in which sailors wake up and go to sleep at the same time each day.

The same type of effect, on a lesser magnitude, can be seen in software development and DevOps. Downtime deployments that must be done in the middle of the night; unreliable systems that require constant off-hours attention are particularly egregious. Constant downtime usually causes an engineer to be paged in the middle of the night during their “off hours.” By contrast, “no downtime deployment,” which is a deployment method where a website or application is never down or in an unstable state during deployment, allows software development and DevOps teams to perform deployments during regular scheduled working hours instead of in the middle of the night. This means engineers can deploy without disrupting their circadian rhythms. Designing our software systems with high availability in mind also increases resiliency, and reduces single points of failure, so the system experiences less downtime.

The bottom line is that software systems, tools, and even engineers’ working environments should be designed with human factors in mind to ensure healthy cognitive function. When it comes to sleep, engineers should be able to maintain regular sleep-wake schedules without off-hour interruptions. No downtime deployments, gradual rollouts, and high availability not only improve the reliability of the systems we build, but also enable engineers to avoid unpredictable and stressful interruptions to their recovery time and sleep schedules.

Stress and Cognition

Another factor that can affect cognitive functioning is stress. Sometimes managing stress can become difficult, e.g., due to situations in our lives such as issues at work or at home or external events. Unfortunately, too much stress can affect cognition 10. Psychological stress can cause behavioral disorders such as depression and anxiety and can damage cognitive function.

Some stress is good for you and is called eustress. Eustress can help you meet deadlines and be a high performer in the workplace by boosting alertness and concentration. Too much stress, however, can impair cognitive functioning. The Yerkes-Dodson law maps out levels of physiological arousal (i.e., anxiety/stress) and cognitive performance. At both low- and high-stress levels, performance is low. However, at an intermediate stress level, the performance of difficult tasks actually peaks.

1920px-OriginalYerkesDodson.svg

Image Source: Wikipedia

The reality is that most people deal with medium to high-stress levels in their lives and should seek to reduce their stress. This problem is made more challenging by software companies who do not take human factors in mind and ask employees to work demanding hours and deliver on unrealistic deadlines. However, these high workloads have a point of diminishing returns. Studies have shown people working over 50-60 hours a week for 8 consecutive weeks end up no more productive than people working 40 hours a week 11. These studies show that when it comes to working productively, sometimes less is more.

Software development and DevOps are mentally taxing and stressful jobs. Too much stress negatively impacts software developers and DevOps engineers’ ability to think clearly and make good decisions 1213. This could lead to design errors, bugs, and improper incident response that can worsen system failures.

Deployment pain is one aspect of software development and DevOps that increases stress 14. Deployment pain refers to the fear and anxiety engineers and other technical support staff feel when releasing code into production. In general, the slower, more complex, and brittle your deployment process, the more painful it will be for everyone involved.

Three key indicators reveal if your deployments are likely to be causing deployment pain:

  1. Software which was not designed with deployability in mind.
  2. Manual changes which must be made to production environments as part of the deployment process. This dramatically increases the chance that human error will cause a deployment to fail.
  3. Deployments that require changes to go through multiple handoffs to separate siloed teams such as Ops, Test/QA, Infosec, etc.

Studies have shown a significant correlation between deployment pain and key outcomes. The higher the deployment pain, the worse the IT, organizational performance, and overall organizational culture 151617. To reduce the overall stress levels of employees and effectively design for human factors, deployment pain must be minimized. Two of the most significant mechanisms to reduce deployment pain are leveraging continuous delivery and moving services to no-downtime deployments 18.

Conclusion

In knowledge work, the primary resource is the human mind. While there are many fiercely debated topics in programming such as what languages to use, or which design patterns or frameworks are best, the scientific evidence that these things meaningfully impact outcomes is usually circumstantial. Yet, we have immense amounts of objective data that show the impacts of sleep, workload, and stress on the mental capabilities and productivity of software developers, DevOps, and human beings in general. This data is unequivocal and has been collected from many different industries. The consequences of ignoring these factors are often catastrophic.

In summary, the technical practices, tools, and automation that enable engineers to:

  • Work in smaller batches.
  • Have consistent schedules and avoid “all-nighter” deployments.
  • Reduce deployment pain and burnout.
  • Increase resiliency in systems and reduce the amount of off-hours incidents teams must handle.

will likely give us some of the highest return on investment for our effort and time.

References