The Multi-Tasking Myth

September 27, 2006

In Quality Software Management: Systems Thinking, Gerald Weinberg proposed a rule of thumb to calculate the waste caused by project switching:

waste-caused-by-project-switching-graph.png

Even adding a single project to your workload is profoundly debilitating by Weinberg's calculation. You lose 20% of your time. By the time you add a third project to the mix, nearly half your time is wasted in task switching.

This can be a problem even if you're only working on a single project at any time. The impact of simply letting your email, phone, and instant messaging interrupt what you're doing can be profound, as documented in this BBC study:

The study, carried out at the Institute of Psychiatry, found excessive use of technology reduced workers' intelligence. Those distracted by incoming email and phone calls saw a 10-point fall in their IQ - more than twice that found in studies of the impact of smoking marijuana, said researchers.

Kathy Sierra wrote a great post comparing multi-tasking and serial tasks and followed it up a year later with a typically insightful post proposing that multi-tasking makes us stupid:

Perhaps the biggest problem of all, though, is that the majority of people doing the most media multitasking have a big-ass blind spot on just how much they suck at it.

We believe we can e-mail and talk on the phone at the same time, with little or no degradation of either communication.

We believe we can do homework while watching a movie.

We believe we can surf the web while talking to our kids/spouse/lover/co-worker.

But we can't! Not without a hit on every level – time, quality, and the ability to think deeply.

Joel Spolsky compares the task switching penalty for computers and computer programmers:

The trick here is that when you manage programmers, specifically, 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.

I've often pushed back on demands to work on multiple projects at the same time. It can be difficult to say no, because software developers are notoriously prone to the occupational hazard of optimism.

We typically overestimate how much we'll actually get done, and multi-tasking exaggerates our own internal biases even more. Whenever possible, avoid interruptions and avoid working on more than one project at the same time. If it's unavoidable, be brutally honest with yourself – and your stakeholders – about how much you can actually get done under multi-tasking conditions. It's probably less than you think.

Posted by Jeff Atwood
58 Comments

The problem with task switching is that many times it's unavoidable. When our project manager left for a new job, I went from dedicated junior developer who only focused on the code to project manager / developer / tech support / tester / etc.

While I agree that multitasking kills your productivity when writing heavy duty code, it has also forced me to become a much better programmer. I believe my code is better because if it.

Instead of just working off hear say from a project manager, I'm actually dealing with the clients and understanding the fundmental problem they are having with the system. I'm able to easily communicate possible solutions and determine the best course of action for the problem at hand. When you aren't in charge of all these things, then it seems like a lot slips through the cracks during the communication process.

Ryan on September 29, 2006 2:20 AM

@Ryan your example deals with different aspects of the same project. Jeff warning is about switching rapidly between very different tasks.

@J.Allen, I think you hit an important point. But the warn is about not abusing.

Vittorio on September 29, 2006 2:45 AM

There's a difference between *planned* context switches, as discussed in the comments, and *unplanned* context switches due to interruptions like email, phone, etc.

If a context switch is *planned*, you plan in time to save state (as it were). If your boss comes in with yet another wild hair, and says "do this now", there's no chance to save state, and the context is lost -- to be recovered later.

This goes well with the concept of getting in the zone, which can take quite a bit of time by itself.

bryan on September 29, 2006 2:58 AM

It's a real problem to me. Even working on just one project, I always get the temptation to check my emails or read some news, under the pretext that I need to relax (which is true but needs not happen every 10 minutes). The result is a mediocre productivity :( I sometimes think that companies should restrict internet use because, working with a computer, it is really difficult to not wander away from your main task. Even reading pages related to your work can easily distract you, because there are all these interested [technical] topics just one click away...

jrme on September 29, 2006 3:14 AM

I actually find a reboot to be a good thing. For instance right now: I give myself 15 minutes to waste time on your blog (and Phil's and Scott's) to clear my brain. "Mind like water" and all if that's to be believed.

Joel's point is valid, but I think one thing these guys might be overlooking is that if you have your process down, you don't need to keep all your bunnies in a shoebox.

Also - as many of the comments point out, you can't escape this. Push-me Pull-you is a fact of life. If you implode with more than one project it might be time to move the booty to a cubicle :).

Rob Conery on September 29, 2006 3:20 AM

I've also seen a number of articles lately that point out that kids ARE better at multitasking than adults. They've grown up with cell phones, internet etc. Maybe it's just that x + 7 = 11 isn't all that hard compared to asynchronous device managers, but all studies also say that the brain just adapts faster when you're younger. It'll be interesting to see when the Y generation hits their 30s and 40s whether multitasking is considered harmful or something that senior citizens talk about. Sign me up for the old folks home, I can't talk on my cell and remember to turn left on my way home.

Steve on September 29, 2006 3:58 AM

Jeff,

I think I should point out that this issue is not that simple.

Men and Woman's brains are different. Women can multitask better than men because we evolved that way.

Back when the human race was forming the male was the hunter and had a single task of finding prey, killing it and dragging it home. All serial tasks. While the women stayed close to home, cleaning, cooking, gardening while whiching over a pack of kids. Women had to do all of this at the same time while keeping in mind where each kid was in relation to incoming preditors like the mean saber tooth tiger. Women developed a multitasking brain.

Now this isn't to say that men have completely different brains as women (or vice versa) but we all fit somewhere on a continuum. Some men can multitask because there brain had developed and evolved through the generations as a female brain.

My point is that there are people (men and women but more women than men) who can mulitask.


Robert Kozak on September 29, 2006 4:16 AM

TYPO: Watching ... not whiching

(Wish I had a spell check in the comments)

Robert Kozak on September 29, 2006 4:17 AM

Responding to the "different female brain" point and the "children" point in one fell swoop, remember that from an IT standpoint the question is about "high-context" tasks. Press me and I can carry on two duplexed conversations simultaneously (although that taxes me to my limit and they'd better be completely unrelated).

But compared to programming, your average conversation is a low-context task. If you come in on a conversation between two of your friends, the amount of time it takes you to come up to speed and contribute something useful is often measured in seconds. For a programming task, I'm lucky to have my first file opened in that time, let alone have anything useful done.

With no intended slight towards the challenging task of being a mother, almost everything you need to know about the cleanliness state of the kitchen is contained in the kitchen itself. (Which is, if you think about it, the reason a dirty kitchen is a problem in the first place.)

I doubt a 15-year-old is *that* much better than me at carrying on 10 IM chats. I remember being 15, I remember exactly how hard homework was. I'm sure I could have done 10 IM chats and my homework too. The homework is slower, but who cares? You've got more than enough time. Programming is different, because it'll take everything you've got and more; you really can't be too good a programmer and what you spend on 10 IM chats isn't being spent on being a programmer. *Even if* task switching was free, you'd still be impaired vs. fully concentrating. (You also tend to have the opposite time situation.)

The high-context nature of programming is critical to the point. People have been "multitasking" low-context tasks forever without a 90% penalty to 5 tasks. That's probably why the high-context penalty is so shocking to people; we haven't got an intuition for it because almost everything we do is low-context by comparision.

Probably the oddest thing is that our brains can handle these high-context activity *at all*; there really doesn't seem to be a call for it in nature.

Jeremy Bowers on September 29, 2006 4:30 AM

Sometimes we simply need to think about something in a relaxed way rather than sitting at our desk looking busy for the sake of it. A change really can be as good as a rest, if we are able to choose a sensible time for the change.

Michael Roberts on September 29, 2006 4:51 AM

"Probably the oddest thing is that our brains can handle these high-context activity *at all*; there really doesn't seem to be a call for it in nature."

That, our philosophical and spiritual nature, and the lack of linking evolutionary fossil record tends to suggest an alternative species genesis than evolution.

steveth45 on September 29, 2006 6:03 AM

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".

Tim Dudra on September 29, 2006 7:23 AM

It is cheaper, if you're a dumber-than-a-sack-of-hair manager (extra points for where that comes from) to treat programming like assembly line work. Managers, to repeat, most always come up through sales; even when the area is technical. Only sales folk really know anything, and often have an MBA. And so on.

Programmers aren't even assembly line help, they're farm workers. Why all the whining?

The Dire Straits quote is telling: Mr. Dudra is either old enough to actually know something, or a very precocious youngun.

buggyfunbunny on September 29, 2006 9:30 AM

Mr. Dudra is old enough to be able to carefully give the impression that he actually knows something, regardless of whether or not he does.

I also agree that treating developers like interchangeable assembly line workers is, for the most part, absurd. It goes to the whole mythical man month thing that given X units of work, if you throw N work units (a.k.a. developers) at it, you will be done in X/N time (although most development managers and RD directors seem to assume floor(X/N) - 10% for great management).

Unfortunately, it is a reality of the industry that people must switch projects from time to time. For this reason, it is imperative for managers to a) understand that there is a cost to this and factor it in - great management doesn't offset this (even when it is real and not imagined) and b) that developers must understand this and pursue the most readable, most cohesive and least coupled code they can so that the cost of a context switch is as small as possible. Saying "our code is complex; you can't switch me on and off of it like that" is paramount to saying "We are doing a bad job so it makes it very hard for us to go elsewhere and then come back to our substandard and difficult to understand work".

Sorry, no time to proofread - the lamb chops are cookin'.

Oh my god "I just admitted to eating MEAT!" Once again I shall be a pariah ...

Tim Dudra on September 29, 2006 9:54 AM

Surely Tim code that is complex to understand and difficult to maintain could be assumed to be legacy code. As such you have to sit down and understand it to make a small change (small from the business point of view).

You don't necessarily say hey this is complex to fix so we should rewrite it instead - most businesses don't want to pay for something they already have, they just want this little extra thing.

Dealing with complex code is something every programmer will have to do, whether they are good or bad.

Paul Broadfoot on September 29, 2006 10:38 AM

I'm not disagreeing with you Paul.

A point I often try to make, and perhaps am trying to make here, is that legacy code is complex and difficult to maintain because it is _old_ code. As my former boss, Steve Adolph, once told me (and I paraphrase 'cause my mind ain't what it used to be),

"Every time you open up a piece of code and make a change, you leave damage. It is like operating on a person; each time you open them up to fix a problem, you leave behind scar tissue".

With enough changes to any codebase, it becomes old, fragile and brittle. Then it is painfully expensive to modify. True legacy code that has evolved over time cannot be prevented.

However, the point I am implying is that the vast majority of code is hacked out without design. Its design, if any, is at best some vague whiteboard scribblings and maybe a brief one or two page analysis of the sunny-day scenario where all goes well. Then, this "design" is encoded by people who all too often allow the debugger to do their thinking for them. I'm sure you've seen it and even done it (I know I have) - you write a for loop or similar construct and think "Gee, does that actually do want I want? I'll go through it in debug". Code built in this manner is code that NEVER had a chance to be young. It was born old, like those cloned sheep in England, because its birth was a long painful process of opening it up, hacking in a patch, and stitching it back together again. Before it is even released for the first time, it is a nightmarish twining of sphaghetti. It is that kind of "legacy" and/or "complex" code that I am suggesting should not occur.

Tim Dudra on September 29, 2006 11:34 AM

But I can code and read Coding Horror posts still, right?

Robb Allen on September 29, 2006 12:05 PM

Obviously! Otherwise how would you possibly know how much time you just wasted?

Jeff Atwood on September 29, 2006 12:22 PM

One thing to consider, however, is experience. Although multitasking is not the ideal scenario, an individual who is required to frequently multitask may be much more adept at it than someone who is normally assigned to just one project and isn't forced off track too often. Sure there is still a performance hit but it is amazing the changes ye ole gray matter can make when necessity dictates.

Ken on September 29, 2006 1:17 PM

This is the trouble with developers capitulating to noisy environments by donning headphones. I simply can't code as well listening to music as I can in silence. I suppose I could if I didn't actually _like_ music. If I listen to music and write code at the same time, I'm only programming at half-capacity.

Kyralessa on September 29, 2006 1:25 PM

Darn, I just forgot what I was about to do.

Jim on September 29, 2006 1:25 PM

OK, Ken, let's assume you're twice as good at multitasking as everybody else, which is probably horrifically unreasonably favorable to you because the costs are fundamental to how our minds are structured, not lack of practice.

At 5 projects, you're still losing 40%, nearly half, of your productivity, which is still one hell of a hit; you've turned what should take one employee into two, all else being equal and allowing for a bit more penalty due to communication and knowledge-base-splitting and synchronization.

And remember, the argument in favor of multitasking isn't that "it doesn't hurt too much"... you're supposed to be getting *more* done. I see no evidence it works that way whatsoever.

Fundamentally, the problem is that we don't know how to intuitively time our losses in switching; multitaskers mentally feel it to be productive time, making "multitasking is hurting you" a tough sell. The problem is, perception of productivity can be very loosely related to actual productivity. It may even be true that while you're switching and coming back up to speed that your productivity isn't *zero* in those first fifteen minutes, the problem is that compared to what you *could* do with those 15 minutes if you were *already* up to speed, the multitasker is doing horribly.

Jeremy Bowers on September 29, 2006 1:52 PM

What about dead time?

I find that if I am only working on one project, then I spend half my time waiting for other people. By having several projects, I can jump to the next one whenever my current one becomes blocked.

Jonathan Allen on September 29, 2006 1:57 PM

Steve, I agree with you in that human beings (it's not just the software industry) tend to always gravitate to extremes - we aren't good at treading the middle ground and most "best practices" fall into the middle ground. For example, there is nothing wrong with socialism and nothing wrong with capitalism _unless_ you take either to the extreme - then they fail. But go to any financial district in the U.S./Canada and you'll find extreme capitalists - go to any university and you'll find extreme socialists.

Where I will disagree with you is your statement "They're used to coding in nested if statements and aren't really going to jive to a polymorphic command pattern" with its implication that nested if statements are simpler than a polymorphic solution (I wasn't discussing just the Command pattern - that is usually overkill for most tasks). If you are nesting a couple of if statements on a one shot occasion, you're most likely correct. However, too often an element of code has a set of state variables that, when interpreted, tell you what operations you need to do. There are also common tasks that must be done and you don't want to duplicate all that code. When the if statements become disastrous is when a program needs to repeatedly (for example in each method it enters) decipher the state variables to determine what special action must occur. Understanding that there are objects that specialize in specific behaviour and then calling those objects where appropriate is far simpler than constantly referencing these state variables and trying to a) remember what they mean and b) decipher the nested if/switch statements that select the appropriate behaviour.

All things in moderation is usually the best. If the differential behaviour is fairly simple and there is not a lot of it, use if statements. If the differential behaviour is significantly different and there are many cases where the different behaviour exhibits itself, use polymorphism. Everywhere in between those extremes you need to consider which option is best _BUT_ and this is a big but (with one 't' as opposed to what I am sitting on), if you are having a hard time knowing which is the correct decision, expect to have to change whichever decision you make at some point and build the system accordingly.

"Just my humble thoughts", he lies unconvincingly ...

Tim Dudra on September 30, 2006 4:10 AM

I've only skimmed the comment of this post, so I'm not sure if I am repeating something already written, but:

I find that some tasks can be done in parellel with no loss in productivity. In fact, I think it may actually gain. I think that one major task is the limit, though. The other tasks must all be trivial. The example I am using is instant messages:

When I am programming, I am capable of conducting 2 or 3 light IM conversations at the same time. My IM client is configured to give a one-time notice of a pending message, which disappears after 2 seconds, so messages don't distract me. I can put them in queue and get to them when I am ready to switch. I have found that when conversation matter is trivial, 2 to 3 conversations while programming non-complex code is no problem.

To go along with the analogy of a computer: the conversations must not require any registers. Once the subject matter becomes complex, I begin to slow at programming. Also when the programming is complex, it requires so many registers that I can't spare any to IM.

The reason for doing this falls in line with what Rob Conery was saying about "reboots". The IMs provide tiny windows where I can switch away from it and come back with a fresh perspective. Of course, these breaks are so small that it isn't a "fresh" perspective, but the break does modify it slightly.

On a larger scale, taking a break to read other subject matter (recreational) when an obstacle is encountered can be very helpful. It goes with the expression to "sleep on it" but on a smaller scale.

In conclusion, some task switching can be helpful. I think the kind described in the original post, though, are generally very detrimental: working on multiple complex problems at the same time, or unexpected interrupts.

Ryan Patterson on September 30, 2006 8:28 AM

I think we're aware of the inefficiencies of context switching, which creates more inefficiencies.

Say you're programming some hariy code before your 2:00 meeting. The phone rings at 1:30, it's someone from the business side with a question that requires some digging. You figure out the answer and get off the phone at 1:50. Now do you try to get back toyour programming task for 10 minutes, knowing it will take that long just to get everything back in your head? I don't -- I check my e-mail and the news.

Of course the more tasks you're on,the more meetings and questions you get, and the more this happens.

At my last job it got to the point where I had to count on only doing development work at home at night on my laptop, since I knew I couldn't get stuff done in the office.

JohnMcG on September 30, 2006 8:54 AM

One more note. This may be a failing on my part, but sometimes I got to the points where I assumed interruptions would happen and wouldn't want to get engaged in anything.

JohnMcG on September 30, 2006 9:10 AM

"Those distracted by incoming email and phone calls saw a 10-point fall in their IQ - more than twice that found in studies of the impact of smoking marijuana, said researchers."

--hmm so I guess smoking marijuana while checking my email on my Blackberry during work hours explains my demotion.

Rob R on September 30, 2006 9:30 AM

Oh no! Another topic that comes down to the same answer: ok in moderation.

Does anyone else find it frustrating that as a programmer used to dealing in pass/fail, true/false that we're completely surrounded by practices and advice that are neither wrong nor right?

I find myself nodding at Tim's remarks, I come across tons of code that was written to obviously keep the compiler from complaining. catch {} and the like. But I've seen the high-design school fail miserably too. Many designs are so absurdly simple and brilliant that no one can understand them. If I'm a code monkey sent in to fix a bug there's no way I'm going to read 20 pages of design documentation so I can fix a bug. Looks like the issue is right there: if(bad) don't do this. Done!

I'm no Architect, and I want to trust and believe in my coworkers and their abilities. But some times simple and elegant is easy for me and 2 other people to understand, but someone else has to work on the code and just can't grasp it. They're used to coding in nested if statements and aren't really going to jive to a polymorphic command pattern.

Yeah, yeah, there's no silver bullet. At least my compiler understands me...

Steve on September 30, 2006 10:29 AM

It’s definitely good that some concrete measurements and studies are mentioned here.

Besides context switching, a lot of other (bad) things can happen because of multitasking, which are not at first as obvious to an individual as loosing time and lowered productivity is. For example, in companies where multitasking is a “normal thing”, meaning that most employees have to practice it for some reason, people who work on only one task at the time are seen from other colleagues as lazy and incompetent. That’s not nice, but the worst thing is that they usually are! How sick is that?

I think multitasking brings many hidden problems.

Love the post. Regards!

Blanka on September 30, 2006 1:57 PM

One final comment on this, to perhaps clarify my words or to perhaps further villify myself.

I had this very discussion with a former developer today. You cannot rationalize that all projects must have a long bug fixing cycle or must be complex just because those you have worked on always do or, as this former developer said, because all the senior developers he talked to said that always happened. That is a fallacious argument in that it assumes that the development team is _not_ the problem. I would allege that in most, if not all those cases, it is the development team that is the problem - there are very few _truly_ complex applications but there are many applications that are _truly_ complex (if you get my drift). Failing that, I'll quote Albert:

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-- Albert Einstein

Having been on fairly large scale projects that did not require lengthy bug fixing cycles at project end and did not become huge cumbersome, complex beasts that were nearly impossible to alter, I have personal experience that this need not be the case. However, having been on projects where developers had no overall plan save what was in their heads (and therefore virtually guaranteed to be different than what was in the heads of the rest of the team) and where those developers simply sat down and started to "cut code", I've seen that software developed in this manner _always_ ends up with a lengthy bug fix cycles and almost always ends up being complex, convoluted and headache inducing.

I'm not implying that Paul was saying this because I don't believe he was. Another rationalization for why a project resulting in bad code is "expected and normal" is that, since almost all projects that live long enough to undergo many revisions and become legacy apps (a very small percentage indeed) are complex and difficult to understand does not imply that all projects therefore will be complex and difficult to understand nor does it justify the argument that it is expected that projects become complex and difficult to understand right off the bat. Rather, it is a rationalization to allow us to believe we are really great developers even though our code sucks.

Finally, with respect to the statement about "allow the debugger to do their thinking for them". What I am trying to say here is that, when you are stuck in the gory details of some code and you are revamping a loop or a class because you just discovered it doesn't quite do the trick, it is nearly impossible to maintain a grasp of the complexity of that loop/class and keep track of the second order effects changing it will have on the code around it. By relying on the debugger to assure you your logic is correct, you are virtually giving up on trying to understand the first order effects of your code, let alone the second order. It is through design that we determine that the whole works as a unit - it is through code that we realize determine how the small units work and, as a consequence, realize the whole - at least that's how it should be.

Well that makes perfect sense to me but, as it is late, I will acknowledge that it might not make any sense to others.

Tim Dudra on September 30, 2006 1:59 PM

I think you guys are totally missing the point here. It seems to me that the book discussed in this thread is about the loss of productivity due to multitasking. From trying to do things like talk on the phone, GOTO meetings, IM, email, and code all at the same time. So the context switch we're talking about here is between email and code or meeting and code, and not the context switch between project A and project B.

I think we've all had those days where there are constant interruptions and you forget what you were supposed to be working on in the first place. One minute someone from sales is telling you the changes they want you to make to a report. And the next someone from marketing is telling you that we just have to have customizable messages print on out invoices. And of course the Emails keep pouring in and the phone keeps ringing. Which is why I think programmers get a bad reputation for being antisocial there are a lot of demands on our time and the cost of interruptions is higher for us then for people with less complicated professions. I know when I'm in the "zone" it doesn't take much to knock me out of it, like the programmer in the next office talking extremely loudly on the phone, which he always does, but I'm kind enough not to mention it to him. And at times I can be cross when someone interrupts me while I'm working on an important issue. And after a day of such interruptions that simple, elegant, almost beautiful code that you just wrote this morning might as well be in Chinese.

P.S. If you really want a good, or at least interesting, read in the project management genre you should pick up "The Mythical Man Month".

William on October 1, 2006 2:03 AM

everybody seems to think that listening to music decreases your focus, i've found that in a loud environment (a shared open space), it's sometimes the only way to isolate yourself from the noisy conversations around you.
Oh wait, maybe that means i should change workplaces to one that actually limits the possible sources of interruption !?

jbn on October 1, 2006 2:29 AM

everybody seems to think that listening to music decreases your focus, i've found that in a loud environment (a shared open space), it's sometimes the only way to isolate yourself from the noisy conversations around you.
Oh wait, maybe that means i should change workplaces to one that actually limits the possible sources of interruption !?

jbn on October 1, 2006 2:33 AM

I recognize this problem. I'm 'currently' 'working' on a lot of things. Writing a bunch of interpreters, cryptographic communication tools, and lots more. The problem is that I barely ever finish anything.
Only for me the problem appears to be that I like to code, have many ideas and want to implement them all. I just can't, and that's the problem. My to-do list grows a damn lot every day, yet I barely ever finish anything, but I'm repeating myself.
Over-motivation, appears to be it. Unfortunately.

Hilco H. on October 1, 2006 5:02 AM

jbn: Music may decrease your focus (and harm productivity) in _comparison_ to a perfectly quiet, distraction free environment. However, I think what the music listeners are suggesting it that it will have less impact on productivity than a noisy, open cubicle environment with Dilbert's overly loud guy in every cube around you and with flashing disco balls spinning ... (c'mon, how often do you get to talk about disco balls in a software setting - I couldn't pass that up).

In other words, to many people listening to music in their head phones is the lesser of two evils.

Tim Dudra on October 1, 2006 5:56 AM

Tim claims with some reason that complexity in context-switches has an impact on the effectiveness of the switch.

However, I can't help but feel one of the quotes in Jeff's post was probably true; "...just how much they suck at it".

Am I the only person ever to have driven home, and realise as I get home that I have totally forgotten the journey? This is a wonderful 'skill' to have, but I have to assume that I was far less attentive (and therefore more dangerous?) on those trips.

JohnMcG, and William have recently posted their observations about the long-term impact of interruptions (even if they are 'anticipated', like meetings). I think this is where Joel's historic discussions on programmer workspaces have been immensely interesting to me (and made me mucho jealous!)

I for one have experienced days where nothing happens due to interruptions. Days where I simply try and fill time because I know that I'll get the work done when I get home (probably interrupting loads of people for a chit-chat in the process).
I wonder how many people actually get their (programming) work done in the office?

Returning to the driving analogy; my gut feeling is that providing your own distractions whilst coding is likely to turn off the critical-judgement part of your brain. So your 'for' loop worked? Great... you just didn't remember that you'd better put something else in a try block or catch an exception in a proper manner!

I'm pretty sure that I have read (possibly in 'PeopleWare' by DeMarco and Lister) that even listening to music substantially reduces a programmer's ability to code a simple routine...

Nij

Nij on October 1, 2006 6:11 AM

-- Surely Tim code that is complex to understand and difficult to maintain could be assumed to be legacy code.

kind apropos of task switching, and comments further up the line (much of them didn't come up until just now; page cached I suppose). it is naive to assume that current code is not difficult to maintain. just because a codebase is written in the au courant OO language doesn't imply that said codebase is transparent.

I have commended Allen Holub's "Bank of Allen" articles before, perhaps even here. it describes what OO is intended to do, and how. most of what exists in java space is procedural COBOL drek, just lower case text; at least the Enterprise stuff. many of its creators are blissfully unaware of this.

maintaining such codebases involves lots o task switching simply to follow how it works.

I also commend Meyer's book; while he doesn't quite get the evil of get/set (Stroustrop and Arnold do, and I can find the quotes if anyone's interested), he does get the notion of Design by Contract. It's his term.

I've always been amazed that folks don't find the existence of the Sequence Diagram in UML just the teeniest bit ironic (well, dumb): a fig leaf to cover the proceduralness of what OO designers are really doing.

finally, I wonder how many of this blogs readers come from the ranks of Management? I doubt that they're listening. To paraphrase one of our prime Knuckleheads: "you're dealing with reality based decision making; we aren't". The mythical man month was mentioned above. The original use came from describing how OS/360 came to be born. That was 1964. True Fact.

buggyfunbunny on October 1, 2006 7:32 AM

These are some interesting statistics. As a university student, I have to wonder if the same effects can be seen in students trying to juggle 5 different courses at once.

Eam on October 1, 2006 9:56 AM

2 things can help eliminate some of the wasted time here, in my experience. Few companies, however, will actually spend the time or money to do these things, but when they do, it helps.

1 - Actual duplication/triplication/whatever of the physical resources to facilitate the multiple tasks, i.e., seperate development machines, each left in a setup state with all software/hardware/network configured and left as-is until needed by that task.

2 - I know this sounds crazy, but I had the pleasure of working for a time with a gentleman who was a brilliant and productive coder who's productivity was increased by drinking fine beers (in moderation of course). I joined him once, at his insistence, and found it didn't work so well for me. I think there might be way too many individual traits and quirks and variables for any kind of metric to be established.

I do agree that many people *think* they are good at this, even take pride in it and brag about their abilities in this area, and yet they suck so hard.

chuck on October 1, 2006 10:05 AM

With many writers talking about the factor of "complex code" and it's effect of making task switching more difficult, doesn't this imply that less complex code is better/more productive? Not trying to start a Holy War, but score some points for Java here.

chuck on October 1, 2006 10:32 AM

I'll agree that programmers often dive into things and write hacks that paper over whatever software is in place, expanding complexity without much benefit. Over a very little time the layers of hack solidify into the traditional Lava Flow...

An interesting thing is that Managers have similar harmful patterns. Lack of priorities, lack of specification, lack of learning from the past. Sending more emails does not accomplish work if there are more interruptions than communication.

interesting thread!

shavenwarthog on October 2, 2006 2:03 AM

Nobody is saying managers are perfect. The next time I see a co-operative effort where one person involved is not, at least to some degree, at fault will be the first time I see that.

Tim Dudra on October 2, 2006 2:38 AM

Oh, My. I must suck.

But that's okay. I don't mind. Really. I find that I write a LOT of code that requires rewrite. What I find most telling is how long it takes to get it into my head. In my current project, there are a couple of routines that take hours to re-assimilate, and I just dread such work. But it must be done. God help the poor soul that tries to get me to change to something else. They don't refer to "The Nice Jim" and "The Mean Jim" for nothing.

I don't mind music, conversation, meetings, etc. when I'm working on something simple, but when I'm working with the more complex routines, "The Mean Jim" is the only one that can accomplish anything. The pointy-haired boss doesn't like "The Mean Jim", but he's the only one who gets anything done.

Task switching among complex tasks costs me loads of productivity. That may be a totally subjective, meaningless, metric, but still a lot.

Jim Lang on October 2, 2006 9:39 AM

@Ryan et al: I agree that some task switching is okay. I tend to work best on two tasks at once, with one getting my full attention, and the other simmering on the back burner. When the main task gets stuck or tiresome, I swap tasks. Many intractable tasks become soft and manageable after being simmered for a few hours.

This works to an extent with three tasks, but not nearly as well. More tasks are impossible, unless there's only 1-2 per day, in which case it's not as bad.

Are there studies that measure how *more* productive people are if they work at home + communicate w/ IM and phone with coworkers? I love it! At every opportunity in which my boss whines I'm never in the office, I suggest that *all* programmers be required to work from home 2-3 days/week, to help speed development

shavenwarthog on October 2, 2006 10:54 AM

"The Mean Jim" - I like it!

A few months ago, I was at a 30+ people team meeting and we had a huge make-or-break demo the next day. Someone mentioned something pretty early on that was going to break EVERYTHING all to pieces. I flipped open my laptop, put my mean face on and started coding 100 lines a minute. My coworker on the team told me later that there were all sorts of questions that were asked passive agressively to the group in general. Everyone was hoping that I would pick up on them and explain things away, but no one dared address me directly. Not that it mattered; nothing short of a fire alarm was going to make me look up from that screen.

Steve on October 2, 2006 11:00 AM

I love this quote "Many intractable tasks become soft and manageable after being simmered for a few hours."

If it _was_ intractable, it could not have become soft and manageable after a couple of hours of thought.

So, why do I love this quote? Not because it allows me to point out somebody's illogic but because it goes to the heart of _everything_ I've been trying to say about design vs. hacking.

What shavenwarthog (good name by the way) is probably saying is "often a task that _seems_ intractable can be solved by thinking about it, even sub-consciously, for a few hours". This statement I agree with fully (especially since they are my words attributed to others - like a god shoving thoughts into the heads of my minions)

The problem with hackers is that they run into these _seemingly_ intractable problems and just dive into them, solving them in the first manner that occurs to them - usually the most brute force approach that could be envisioned. Generally, when doing this, they are not building a simple throw away test app or creating new code; no, they are modifying existing code while they do this so the damage their bad, brute force solution causes ripples through the codebase as they tweak things here and there to make the poorly analyzed, poorly considered idea work.

In this case, a context switch to let your sub-conscious work on the problem (remember, it uses 90% of your brain and your conscious uses 10%) instead of your conscious mind allows you to think through the problem which is, after all, step 1 in design. Then all that remains is to record the design so others can comment/review and later learn about what you are proposing. Doing the design is yet one more way of forcing you to _think_ about the problem instead of hacking out the brute force solution.

Now the comment by buggyfunnybunny of "I've always been amazed that folks don't find the existence of the Sequence Diagram in UML just the teeniest bit ironic (well, dumb): a fig leaf to cover the proceduralness of what OO designers are really doing.".

I promise to think about this one since I've never thought of the sequence diagram that way. However, my initial reaction is to disagree. Sequence diagrams that show purely procedural code are lousy - they don't design anything since you make call "Foo()" to object "Blee" and then it returns. The reader has no idea what went on inside Foo or what effect it had on Blee or the world around Blee. A well done sequence diagram shows how multiple objects, each with its own areas of expertise being exposed by their contract with the world, _co-operate_ to accomplish a common goal. It is, in that sense, OO in its purest form.

Tim Dudra on October 2, 2006 12:49 PM

I forgot to add:
The flow of a sequence diagram and the flow of procedural code are only similar in that each illustrates actions over time. Time being one of the critical dimensions in my universe (and likely yours). The flow of time is something that every system must address. Without addressing the passage of time and events across time, the system doesn't really model anything in the real universe.

Tim Dudra on October 2, 2006 12:54 PM

A few random comments in no particular order (or relevance!)

A) I actually program _better_ with music on than without; really anything that requires deep thought actually. I find it far more difficult to "zone" without music -- sometimes even impossible.

B) The company I currently work for is extremely into multitasking in the truest sense of the concept -- everyone working on many ongoing project teams across multiple time zones and completely asynchronous schedules, and in all honesty I feel like I am less productive, creative, and produce worse code than at previous jobs that were aligned more along more classic "big projects" where you could focus on one major thing for some period of time.

Between emails, IM barages, phone calls, meetings, and random / unplanned /unexpected distractions and knowledge tapping an entire day can slip away with no real coding or technical work being accomplished.

All to often I find myself having to code in my laughingly referred to personal time in the evening hours just so I can get some freaking work done without distraction. Its just very wrong.

The most frustrating part of it is of course, most of the IM's emails, phone calls, and meetings didnt REALLY need my input; all to often I'm being roped in to serve as a woobie to make someone else comfortable making general technical decisions, to hold their hand through something that should be a routine part of their job, confirm or refute things they should already know, or just provide general brainpower. Things that have nothing to do with the actual development of software, in other words.

(Who here has ever felt the urge to automate the jobs of their co-workers just so you could get some peace and quiet?)

D) Another problem with the multi-tasked environment is that monolithic blocks of time where all the principles involved in a project focus and hammer things out are practically impossible to accomplish; even suggesting "Hey, shouldnt we actually take some time and figure out a good design for this BEFORE we piecemeal it out and hope it all somehow works" will draw "whose this crazy person?" looks in this sort of environment. No one takes the time to do things correctly and focus on process and design in such an environment; the entire culture of such a setting is founded on a unstructured non-process and its anathema to intelligent focused development.

C) However all that aside, what I find most frustrating and annoying about multitasking is the inevitable fallout that occurs when you leave things half done, do things in a rush between interruptions, or get part of something actually done but have to do a brain dump and spin up on one or two or five different other projects before circling back to develop related components / consuming code, or what have you.

This and other interrupted scenarios causes mistakes, sloppiness, disjointed, and buggy development. Errors, either in concept or execution or both creep in all too often. The product is compromised. And if you are constantly chasing deadlines on most or all of your multiple projects that you are multitasking between...it just gets worse.

I've made several mistakes that I know I never should have or would have made if I was able to focus and finish a key piece without distraction or interruption, that were directly attributable to fall out from multitasking.

This is the real bugaboo of multitasking for me, becuase even if you do realize some time saving, and are able to "cover" a majority of tasks that are so routine or subcranial that you can handle them even at 40 or 50%, the mistakes or losses of efficiencies that crop up in those tasks that take 60 or 80 or 110% to get done _correctly_ have costs that are realized later on.


In the end I always recall the saying "Fast, Cheap, Good -- Pick Any Two". Multitasking is Fast and Cheap, but it aint good.

Killer Shrike on October 3, 2006 1:44 PM

To be completely honest i am a horrible multitasker. Some peaple are awsome multitaskers and other well....well just say that they shouldnt drive while talking on the phone or..well......CRASH!


And whoever mentioned females being better multitaskers was definitly right about one thing but comepletly wrong about how men and women worked in the stoneage...you could use a little history lesson.

Multitasker pro on March 13, 2007 8:04 AM

I object to the idea of a statement like "women are better multi-taskers than men" unless the poster provides a reference to a critical reference where this was proven in a sound experiment or at least a good "thought experiment".

Remember the idea here is that people "think" they are effective multi-taskers. This conjecture seems to be more of this type of groupthink that leads to a continued belief that unplanned multi-tasking is laudable rather than wasteful.

Tom Swider on April 10, 2007 3:42 AM

i tried to email this post to some of my colleges half way thru reading it because i thought they would be interested... and sent the wrong link

daniel on August 8, 2007 11:02 AM

How do people feel about working multiple task while slightly inebriated?

Nick Heitz on August 28, 2007 8:44 AM

Here's a website that discusses some of the results of real studies on the differences between men and women's brains, how they develop, and how they are used in different scenarios (including multi-tasking).

http://www.enotalone.com/article/4893.html

thoward on November 5, 2007 4:54 AM

http://www.youtube.com/watch?v=fXIeFJCqsPs

It's a TED talk about getting in the flow or entering the zone.

When we do that all our sensorial bandwidth is used for that task, so we can't even process our own body. Like a OS which is using all resources running one process without passing into kernel mode.

Demian Garcia on March 8, 2009 1:09 PM

@ Robert Kozak You might want to read Crenshaw's The Myth of Multitasking. He talks about the women-men issue specifically.

Marcy on July 3, 2009 9:45 AM

Johanna Rothman has talked about this over the years:
http://www.stickyminds.com/sitewide.asp?Function=edetailObjectType=COLObjectId=7198tth=DYNtt=siteemailiDyn=2

It's often a symptom of trying to manage software development projects as a typical business project - break a big task into a bunch of smaller tasks and assign them out. With that mindset, it seems simple to tell Worker #145 to stop task 5 and work on task 6 a little bit - stop shovelling blurps and start ratcheting vleeps. It comes from treating software development as unskilled labor.

Jon Galloway on February 6, 2010 9:51 PM

I agree with Rob Conery on this, though. I find that it's best to have one major project and another side project which is not urgent or complex. It's good to be able to take a short break from mindbending stuff and crank on something simple. It's also helpful in the case where the main project is subject to delays for business review, waiting on information from outside sources, etc.

Jon Galloway on February 6, 2010 9:51 PM

The comments to this entry are closed.