I have ADHD and anxiety. They interact, and it’s impossible to say where one ends and the other begins.
I can focus on a task, but if I get distracted, it’s often very hard to bring myself back to whatever I was doing. The cost of “context switching” – rebuilding the mental edifice of what I was doing and why and what I was going to do next – is exceptionally high for me. Sometimes the context switching is so cumbersome that I get distracted again before it’s done. Depending on the degree of anxiety bouncing around in my brain, this cycle may just repeat until I run out of day.
So there’s that, and then there’s also this: I’m mostly in technical leadership roles these days. I spend a lot of time in meetings and Slack threads and emails, which means I don’t get much heads-down time in a given week. And what heads-down time I do get is often split up into hours here and half hours there. Plus I have a kid now, which, while wonderful and great, is another way that my calendar gets all chopped up.
In a given week, then, if I want to accomplish any significant effort that requires focus (usually writing, research, or coding), I need to minimize the cost of context switching. To this end I’ve lately been using a system inspired by the call stack. (Note: I say “inspired” because it is not a direct analog of the call stack; please don’t expect it to be.)
Suppose I’m coding. I open my text editor to write code, but I also open another text editor to an empty file, visible on the same monitor. I call this empty document the stack. Whatever the thing is that I need to do, I write it in the stack:
implement widget feature
Implementing the widget feature is a multi-step process, though, so I need to create a few children of the implement widget feature
task:
write definition and doc string for widget function
write widget test
implement widget function such that it passes tests
implement widget feature
Children of a task appear above the task and indented. The three lines above implement widget feature
are its children.
When working with this stack system, the top item on the stack is always the thing I’m currently doing. So, in the example at hand, I’m currently working on the task write definition and doc string for widget function
.
But maybe, when I get to work writing the doc string for the widget function, I remember that I saw a good blog post about how to design functions like this. Maybe I want to reread that blog post before I commit to an interface. That’s fine! I can push (add at the top) a line for that:
reread that blog post i saw
write definition and doc string for widget function
write widget test
implement widget function such that it passes tests
implement widget feature
Now the top item in the stack is reread that blog post i saw
. So I load up the post and start reading.
Of course, after I’ve read a few paragraphs, I see a Slack notification that I need to attend to: an alert about API latency. Normally, I would go deal with that, and by the time I got back to my terminal I’d have to rebuild all my context. But with this stack system, I can just add an interrupt: a task that temporarily steals the top slot. Like so:
deal with API latency alert
reread that blog post i saw
write definition and doc string for widget function
write widget test
implement widget function such that it passes tests
implement widget feature
As always, the thing I’m currently doing occupies the top line in the stack. So now I’ll hang out in Slack and Datadog for a while, digging into this alert. That may involve adding children of the deal with API latency alert
task, or it may not, depending on how much I need to hold in my head. But let’s say it doesn’t – my teammate says she’s on it, and she doesn’t need help.
So I come back to the stack and pop that task off it. By “pop” I just mean delete the line. Since my current task is always the topmost line in the stack, I always delete (pop) the top line. Now I’m back to the widget work:
reread that blog post i saw
write definition and doc string for widget function
write widget test
implement widget function such that it passes tests
implement widget feature
I don’t have to worry about remembering what I was in the middle of. The top line is reread that blog post i saw
, so I can immediately jump back into that. When I’m done, I pop that task and move on to whatever’s now on top. And so on and so on, popping lines as I finish them, adding lines as I think of followup tasks or feel the need to break down tasks by adding children.
I’ve started a Github project called impulse to elaborate on this idea, but so far the README for impulse is entirely aspirational.
Anyway, that’s my stack system. If you have context switching difficulties like me, try it out! It’s cool.
Pingback: Takeaways: managing attention with stacks – Dan Slimmon