Home » Context Switching Sucks

Context Switching Sucks

During my day job as a sysadmin I spend all of my time in a text context. I read and write Python, English, bash, and on a bad day some SQL. Switching between text and speech, when someone comes into my office to ask me a question, can completely derail whatever I was doing. Context switches like this are fairly expensive when it comes to working on a hard problem, multiple levels down. Ted Dziuba has a great article about this on his site. I’ve also found that switches between programming languages are painful i.e., going from writing Python to Java without some sort of break in between.

Luckily, I work at home with non-technical people so I don’t often need to give verbal stack traces. I do, however, go to school during the day. I’m a senior and my degree is in German so most of my classes are, at least partially, in German and I’m expected to participate in conversation and reading. The context switch from English to German is pretty rough most days, it is especially so when I’ve spent all morning in a text context.

One, very unfortunate, day I spent about 5 hours straight writing Python before going to the German class. No one else in the house was awake, the kids were at school, the girlfriend was up late so she was asleep when I woke up. I didn’t speak a single word to anyone all day; I spent the entirety of the morning writing code…I don’t think I even chatted in IRC, at all, I just programmed all morning. In class we were just doing conversation and reading aloud from the book, nothing else that day. Going from Python to English to German to English to German (repeatedly) gave me a massive headache. By the end of the class my brain felt like it had been put through a meat grinder.

I spent the rest of the workday (2 hours) trying to get back to where I was when I left, dynamic languages seem to require more information be kept in a “stack” in the programmer’s head than static languages do. I’d planned a bunch of stuff for after work that evening, finishing a novel that I’d been reading and some homework for the Java class…It never happened. After work I did nothing but watch TV and take Ibuprofen because my brain was so over worked from the context switching; I could hardly function.

I don’t have a good solution for handling context switches like that, yet. I’ve experimented with spending some time just talking to people before having to go to the German class, I’ve tried watching TV in English on my lunch break before going to class, and I’ve tried taking more frequent breaks during the morning (with frequent notes about where I was, in the code, and what I was doing there). The last experiment seemed to be the most helpful, I didn’t feel quite as bad after the switches but it isn’t a complete solution i.e., there is still some headache involved.