Context Switching as a Software Developer

Last edited: Nov 17, 2022

As a software developer, I find myself context switching quite often. I would define "context switching" as similar to multitasking, but different in that the tasks being performed have different mental or physical environments. An example of a different environment in programming could mean: switching IDEs, switching projects, switching modes of communication, etc.

Examples of context switching that I do every day at work include:

A common theme with these examples is that, by themselves, they are positive activities. I need to respond to PMs, help coworkers, and go over the task board. However, the negative effects come from not dedicating myself 100% to the task at hand.

Cornell University's Ellis Idea Lab found that it takes 9 and a half minutes after switching between software applications to get back into a good work flow (src - archived version), and also that this context switching between tasks and applications "Depresses productivity and causes fatigue". Reading this confirmed my suspicions that multitasking harms my work productivity and work satisfaction. But how to fix the problem?

A way that I have attempted to mitigate the challenges of working in team-based software development is by minimizing the effects of interruptions. I do this by analyzing if the distraction is something important like a manager that I need to respond to. If it can wait, I make a small note in a text file and come back to it after I have finished with my current task. Failing that, I try to leave myself a detailed note with a task number as a mental foothold to get myself back in the zone.

Another temptation for me as a developer is to try and multitask while waiting for a long running process to finish. Let's say I have an npm build that is taking a long time. What I have done in the past (and still do occasionally) is to take a quick break or do another work task. However, I have found that this inevitably distracts me to the point where any potential benefit I could have gained by multitasking is nullified by the time spent distracted. Better to take that break after finding a good stopping point.

Simply stated: If I finish my current task or find a good stopping point before switching tasks or taking a break, I am able to complete both tasks using my full attention while feeling less overwhelmed.

Let me know if you have any other tools or suggestions to avoid the negative effects of context switching!