Be More Productive: Avoid Task Switching

Be More Productive: Avoid Task Switching

A big annoyance in software development is having to wait around for tasks to complete; the larger the codebase, the more common it is. Some examples:

  • Compiling and deploying the project.
  • Pushing and pulling new code from the version control system.
  • Running automated tests.
  • Generating and converting assets.

All this waiting around is a productivity nightmare which is sometimes underestimated, especially if the task itself doesn’t take long. On a large ASP.NET project I am working on, the web engine spends roughly a dozen seconds or so on startup tasks before the first page can be displayed. This happens after each compilation.

At first look it doesn’t seem that big a deal: it’s only 12 seconds after all! However – coupled with how often we recompile – those 12 seconds feel like forever while staring at a blank screen. This leads to an urge to do something else, such as checking out Hacker News or watching a video on YouTube, and the next thing I know 30 minutes have passed and I’m reading about spontaneous human combustion with no recollection whatsoever of how I got there. Whoops!

The first programmer excuse for legitimately slacking off: My code is compiling

Someone more disciplined than me may prefer to spend that time writing documentation or reading tickets on the bug tracker. Unfortunately that’s still going to a be big productivity hit as the problem is the task switching – we’re just not wired to do that:

Task switches take a really, really, really long time. That’s because programming is the kind of task where you have to keep a lot of things in your head at once. The more things you remember at once, the more productive you are at programming. A programmer coding at full throttle is keeping zillions of things in their head at once: everything from names of variables, data structures, important APIs, the names of utility functions that they wrote and call a lot, even the name of the subdirectory where they store their source code.

If you send that programmer to Crete for a three week vacation, they will forget it all. The human brain seems to move it out of short-term RAM and swaps it out onto a backup tape where it takes forever to retrieve.

The best way to resolve this problem and live a more productive life is to cut down the time you spend waiting or eliminate it altogether, for example by skipping all non essential startup steps while compiling in debug mode and using top-notch developer machines. This will also make programmers happier because let’s face it: having to wait for the computer is just frustrating.

Some waiting times are however impossible or unfeasible to eliminate. Compile times for large enough projects can take minutes even with the best hardware available, and there is simply not much you can do to eliminate them completely. If this is the case try resisting the urge to do something else and just stare at the screen until the task completes (assuming it doesn’t take an absurdly long time). By doing so you will avoid task switching: the number one productivity killer.



Leave a Reply

Your email address will not be published.

*
*
*