Most of us want to be more productive. As a result, one of the common mistakes that you might end up making is to multitask. Intuitively it makes sense that if you are doing more than one thing at a time then you will get more done. Sadly, that is usually not the case. You end up getting less done.
If multitasking is hurting our productivity then why do we do it? Trying to multitask ends up hurting your output, but leaves you feeling productive because you are doing more. The problem is that doing more does not necessarily mean you are making progress. The extra work you are feeling can come from having to constantly make context switches between different tasks. Context switching hurts your progress by adding a time penalty each time it occurs (more on this point later).
Humans Cannot Truly Multitask
Many of us think we can multitask. I used to think I can too until I realized it was causing me to get nothing done.
We can’t talk on the phone and write a meaningful email. We can’t hold a deep conversation with someone and browse the internet. We can’t write a report and watch a movie at the same time. What do all of them in common? We believe that we can do all those things, while in reality, we cannot.
There is also the hidden dangers that associates with multitasking. Usually, the quality of your work degrades when you multitask, but you do not realize it because you have been working more. Also, multitasking limits the opportunity for you to have deep thoughts about a subject, which is a bad habit for software developers.
Programming Is a Highly Cognitive Involved Task
Programming is not one of those tasks that you can immediately start on. You simply can’t start from a fresh state and be able to code immediately. Before you begin to code, you need to “load” relevant information about the project into your short-term memory. You need to get in the “zone” or state of flow. When you are coding, you are holding hundreds of things in your head at once that pertains to that one project.
When you multitask, what you are doing is discarding the information you have spent time “loading” into your short-term memory. Multitasking is counterproductive if you consider that most progress in software development is achieved when you are in a state of flow. Being in a state of flow means being in a highly focused mental state where you are fully immersed in the process of the activity (coding in our case).
Context Switching Comes with a Penalty
Task switching or context switching takes a really long time. This is because programming is a kind of task where you must keep a lot of things in your head at once. A programmer that is in the “zone” or in flow and coding in full throttle is keeping hundreds of things in their head at once.
For example, variable names and what they do, data structures, file structures, important APIs, the flow of the code, important sections of the codebase and what they do, names of functions and what they do are a small set of what is on a programmer’s mind when coding. The list can go on, but I’m sure you get the idea.
If a programmer suddenly stops working on the current software project and jump into another one, they will not be able to begin immediately. What happens is that they start to “load” the information about the new project from their long-term memory into their short-term memory. This process takes a very long time because there is so much information. The information about the previous project is replaced by the information about the new project. So, there is no fast way to get back into the previous project either.
Context Switching Example
To see the cost of context switching, let’s look at an example.
Suppose you have two projects. We will call them project A and project B. Each project is small, so it will take about one week (~40 hours) to complete each one. The time it takes to make a context switch from project A to B or vice-versa is 3 hours.
Now, you can approach the projects in two ways. One is complete the projects one-by-one (sequentially). The other way is to work a bit on one and then a bit on the other (multitask).
Let’s look at the sequential case. If you approach the projects sequentially, you would take 40 + 3 = 43 hours per project. In total, you can complete both projects in 86 hours.
Now let’s say you want to mix things up and alternate between project A and B every day. For this example, let’s keep it simple with 2 weeks (10 days) to complete both projects. Since you are alternating the project every day there is a total of 10 context switches. This means one project would take you 40 + 5*3 = 55 hours to complete. In total, you can complete both projects in 110 hours.
Wow, look at the difference between the two cases. You spend 24 hours more to complete both projects when you try to multitask. That’s a whole lot of time being wasted on context switching. Worst of all when it is happening, you are sitting idle and cannot make progress on either project.
I hope you found this post helpful. If you found this post helpful, share it with others so they can benefit too.
What are your experiences with multiple software projects? Do you prefer the sequential or multitask approach?
To stay in touch, follow me on Twitter, leave a comment, or send me an email at steven@brightdevelopers.com.