Context Switching pt.1: What's the Cost?
Tags: agile, development, productivity, team
Published: 2024-01-31 16:15:39

​​​​In today's fast-paced world, where multitasking is often glorified, context switching is an unavoidable aspect of both our professional and personal lives. Companies often even state a requirement for the ability to multitask in their job advertisements.

The tendency to rapidly shift from one task to another has become a defining characteristic of contemporary work environments, more so in the complex world of software development.

As much as we'd like to believe that juggling multiple tasks simultaneously is a hallmark of efficiency, evidence suggests otherwise.

This is the first part of a series on the topic of context switching. Today, we're addressing what context switching actually is, why it is a problem, and what its true cost is. The goal of this first blog post is to examine the depths of context switching, look at its broader implications on productivity and quality of work, and start laying the groundwork for practical mitigation strategies.

In the following parts, we're going to have a look at the psychological and scientific aspects and then cover tips and practices that may change the way you approach your day-to-day activities.

##What is Context Switching?
At its core, context switching refers to the process of moving from one task to another and adjusting our mental context accordingly. You've likely heard the term context switching tossed around in workplace conversations or across productivity forums, but do we really grasp what it entails?

In software development, it typically means moving from coding to a meeting, then jumping to email, and back to debugging. Then a barrage of Slack messages, an unexpected call, or even a 'quick' progress call - all within a short time.

Yet this phenomenon isn't confined to developers alone; it’s prevalent across countless professions and can seep into our home lives too. Context switching is essentially the mental gymnastics we perform when shifting our focus from one task to another.

For professionals, particularly those in intellectually demanding fields like software development, context switching is like trying to juggle while running a marathon—you're bound to drop the ball, or worse, burn out before reaching the finish line.

##Understanding Context Switching and Its Impact on Productivity

In the pre-digital era, professionals often dealt with tasks sequentially, allowing for a deeper focus on each task. In the industrial era, work was often repetitive and singular in focus, contrasting sharply with today's digital age where professionals juggle diverse tasks. Today, however, the digital age has exponentially increased the frequency of context switching, bombarding us with a constant stream of emails, messages, and notifications. This evolution from a mono-tasking to a multi-tasking work environment has significantly increased the frequency of context switching. This shift has not only changed the way we work but also significantly increased the cognitive load, making it more challenging to maintain productivity and focus.

Context switching is the nemesis of deep work. Deep work requires uninterrupted periods of concentration, fostering an environment where high-quality, productive output thrives.

Studies underscore a grim reality: It's not just a mere minute or two to refocus; the cognitive gears need significant realignment. The toll it takes on productivity is not trivial. The cognitive load imposed by task switching can see developers losing precious minutes of concentration, leading to a dip in productivity.

Let's have a look at some statistics from various researches on context switching done by Atlassian and Reclaim.ai:

* It can take a staggering 9.5 minutes to regain workflow post-switch. Some other studies even talk about up to 23 minutes. Imagine the cumulative effect of multiple switches in a day.
* 97.5% of people cannot multitask effectively.
* The average person is interrupted 31.6 times per day.
* On average, the loss in cognitive capacity (thus productivity) due to context switching can be upwards of 20%. That is a 'fifth-day' practical loss in a typical work week.
* At least 45% of people self-characterized as less productive while context-switching.

## Multitasking vs. Multi-Failing

It's a common misconception that multitasking boosts efficiency. However, research consistently reveals that only about 2.5% of people can effectively multitask. Essentially, when we believe we are multitasking, we're often just task-switching with lower efficiency and quality as the unwanted sidekicks.

The takeaway here is stark: context switching, though an unavoidable aspect of modern professional life, is a substantial drain on productivity, creativity, and performance.

So what happens when we context switch, particularly in mentally taxing jobs? Once the interrupted person returns to their initial task, it's not just a matter of picking up where they left off; they must also reload the context of the problem space, which imposes a significant cognitive load. The time needed to resume a previous task isn't just silent time; it's active cognitive effort being expended without contributing to the task's progress.

It's a phenomenon where the brain changes its 'mental control settings' when moving to a new task.

## What are the Types of Context Switching?

Factors influencing the disruptiveness of task switching include the nature of the interruption (self versus external), the complexity of the task at hand, and even the time of day. What factors influence the impact of context switches? We can distinguish between a few basic ones:

* Switch of topic: we jump to a completely different topic of problem
* Switch of depth: we remain in the same problem, but jump to a different level of it
* Externally caused switch: someone else actively interrupts us
* Internally caused switch: we initiate a switch by our own voluntary decision
* Complexity of task: how mentally challenging a given task interrupted by a switch is

For example, complex tasks, such as writing new code or solving software architecture problems, usually suffer more from interruptions than more routine ones, such as checking email or attending regular meetings.

Switching both the topic and depth of tasks is found to be particularly jarring and draining for productivity, indicating the complexity of cognitive processes involved. For instance switching from performing routine, procedural tasks to tackling strategic, high-level thinking imposes an even greater load on our cognitive capacity.

## The Unseen Thief: Self-Interruptions and Their Stealthy Toll

Not all interruptions are created equal. While you might assume external factors are the primary culprits in hijacking your focus, the reality appears to be quite the opposite. Research on context switching has revealed some intriguing findings, particularly about self-interruptions.

The urge to switch to a 'quick' secondary task is alluring, yet it leaves us suspended in a state of reduced productivity for longer than we might expect. The "Let me just quickly check the status of that other task" disruption.

It’s somewhat counterintuitive, but those moments when we voluntarily shift tasks - those moments when we decide to switch tasks on our own, think of checking a quick email mid-task - can be more disruptive than if someone else had interrupted us. The autonomy we value so much appears to have its drawbacks, as these self-directed switches tend to lead our productivity astray.

I think this is fascinating. Why? Because it suggests that the mere act of deciding to shift focus is in itself a distracting force.

Through self-interruptions, we disrupt our workflow often underestimating its impact. It appears that the structure of our productivity is linked to our discipline in managing (and resisting) these self-imposed diversions. And for those of us in leadership or team management roles, understanding and guiding teams through the maze of self-interruption can be the key to unlocking higher efficiency and better mental acuity.

Now, while we might not have the power to eliminate all interruptions (some are necessary and valuable), we can create a structure that minimizes unnecessary self-imposed diversions. This includes creating strict "focus zones" in our work schedules or employing stringent, but realistic, communication protocols.

But it's worth noting that voluntary task switching may sometimes be synonymous with poor impulse control.

When we talk about the challenges of context switching, it's important to consider how looming deadlines or upcoming commitments, like meetings, add to the cognitive strain. This aspect is often overlooked, yet it plays a crucial role in how effectively we manage task transitions.

## Cognitive Challenges Faced by Agile Software Development Teams

Agile methodologies, with their emphasis on adaptability and collaborative work, have revolutionized the software development landscape. However, even the most well-oiled agile teams are vulnerable to the cognitive overload that context switching can induce.

In agile frameworks, the quick feedback loops and iterative processes demand frequent task transitions. Novice developers especially may find this environment sprouting with cognitive landmines.

The cognitive overhead of managing multiple agile practices can ripple through a team, affecting communication, work quality, and mental exhaustion.

Statistical Insight: A survey found that 45% of agile practitioners named "managing distributed teams" as a significant challenge in agile implementations, suggesting the cognitive complexity of coordinating work across contexts and locations.

## Conclusion

In the first part of the series, we've discovered that it's clear that this phenomenon is more than just a minor inconvenience. It's a significant challenge that impacts productivity, software quality, and mental health. We've explored the cognitive tax of context switching.

In the next part of this series, we will shift our focus to the psychological aspects of context switching. We'll examine how it affects our mental well-being and the subtle signs that indicate an overwhelmed context-switching capacity.

Written by Otakar Krus.