Well, steveth45 is clearly clueless. Let’s not adopt multi-tasking as yet another “proof” of the influence of cod on our daily life and our existence. If cod or a facsimile thereof even exists, which I personally doubt, then they are a fickle cod and hopefully will get over-fished to extinction by whatever “powers” dominate cod’s surroundings.
That said, I think I agree with Jeremy Bowers in that people are able to multi-task (all people including us stupid, tunnel visioned, ego-driven, militaristic and generally evil hunter types not just the intelligent, caring and inherently good gatherer/child nurturer types). Last I checked, most of us (except steveth45) can walk and chew gum at the same time. Most of us can read a book and draw parallels to our life experience.
What is not being said here about mental context switching while programming is the complexity of the code. Joel Spolsky’s quote touches on this (but only at the negative side) when he says “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,”.
The complexity of the code you are working within is perhaps the single most important factor in whether you can/can’t context switch quickly. If the code is well architected, well designed with clean, cohesive components and classes, context switching is not very expensive. You move to a domain where the things in the domain accurately model the problem space; understand the problem and you understand the code. On the other hand, if the code is bailing wire, bobby pins and brute force algorithms, then the context switch can be huge.
One chunk of code we had on a project was so complex that, after some analysis, we determined that it took a developer about one full work week to ramp up to the point where they could fix a bug. Additionally, because of its complexity, if you left that task for a couple of weeks and came back to it, it once again took you 3-5 days to ramp up. This was code that was built with brute force logic, poorly cohesive data structures and with if statements to handle every bit of variable behaviour (as opposed to encapsulation with polymorphic or aggregated handling of behaviour).
This brings me back to Joel’s quote - if the codebase requires a programmer to keep “zillions of things in their head at once” then it (or more accurately, its creators) is at fault for the time a developer spends context switching.
The gut check here is, if it takes you or somebody else a long time to ramp up on your code, then odds are you’re not a good programmer. Odds are you are one of the ones we laugh at when we consider the recent finding that “95% of all software developers believe they are above average”. 45% of them MUST be wrong. To quote a line from Dire Straits “Industrial Disease” and a quote sure to please steveth45
"Two men say they’re Jesus, one of them must be wrong".