One aspect of context switching I struggle with is that often a task requires short periods of forced inactivity, like waiting for a script or query to finish. Often times it’s in the scale of 1-2 minutes. It feels long enough that I don’t want to sit there staring at a progress bar, but switching to another task momentarily definitely can cause a loss of focus.
The solution is probably something along the lines of: become more comfortable sitting and reflecting on the current task. Find ways to remain engaged with the current task during the waiting period (reviewing the code, adding more comments, fleshing out next steps, etc.). Don’t give in to a perception of “justified” context switching.
Sitting down and not actively thinking is actually very beneficial and healthy. It will give your brain time to re-order and reset, sometimes even makes you come up with great ideas. Just letting your brain to its thing for a couple minutes is also part of meditation practice for this reason. So I try to use these moments to just check in with myself and let any feelings come to life without trying to judge or think about anything particular.
I am very compelled to start any new task which “feels productive” even in the shortest amount of breaks (also during calls when other people talk etc), it is really tiring. If you also have this strong urge to do so maybe you should check if you have ADHD.
Always this ADHD excuse. Here's the thing, it's normal and human to have difficulties to concentrate for a long time. No need to go and look for a diagnose.
Implying ADHD is an excuse is a deeply concerning statement. It’s a serious illness and a lot of people really suffer from it.
Also I don’t understand your point, it totally depends on how strong the difficulties are whether you might have ADHD or not. „Difficulty in concentrating“ is not a binary metric.
The thing is that everywhere on Hackernews and society in general ADHD is brought up as the cause to a lot of peoples issues while the issues usually are just normal human behavior such as problems concentrating and sitting still for more than 15 minutes.
"Implying ADHD is an excuse is a deeply concerning statement."
This is exactly what I mean. OP says that we should check if we have ADHDH because we have difficulties starring at a progress bar for a minute and instead want to read the news or other activity. That is not ADHD.
Can I ask, was school too easy or hard, boring or interesting?
Interesting that it disappeared :-)
I wonder how many kids would not be considered having ADD if they got more say in how their school day looked. Maybe sports before sitting still and reading?
Context switching destroys me if it's in that annoying valley of >1m || <60m. Less than a minute or more than an hour I can just vibe, or change task ahead of time but otherwise... RIP that hour.
I agree. I greatly prefer to remain engaged in a task or activity even when it's forcing some inactivity. I'll absolutely reflect on it rather than get shunted off to some extraneous thing in the belief that I must be 'productive' by putting in some cycles on something else. I will pay a price if I fall for that simple mistake. I'm autistic and REALLY don't handle context switching gracefully.
It's tricky managing this, sometimes. If you're working with someone and their context and state is very different, it's easy for them to be blind to whatever my context is, and demand responsiveness when I'm 'tuning out' (staying engaged to what's in-process). My best social behavior there is to gently resist, and then if the heat's rising, comply with whatever I'm being derailed into with gentle inefficiency even if it makes me seem like a terrible dimwit.
In this way it helps establish that something's going on, that I am not in fact effortlessly able to be derailed this way and that. It's not people's responsibility to know my state (particularly if I'm not insisting they keep track of it), but it's my responsibility to be reasonably honest about where I'm at with it.
At that point, it's on the other person to observe :)
Compiling... it is a terrible UX and interruption of flow. For years at work I stuck strictly to dynamic/interpretted languages as no compiled language was worth using as they all killed productivity with their terrible compile times. Waiting even seconds for something to compile kicks me out of the zone and I have lost context and must re-orient to make sense of the output. I truly don't understand why developers put up with the stupidly slow compile times other than having no choice. In a time with such an emphasis placed on user experience why do developers get such a shit set of UX choices?
1. There exists incremental compilation which reduces waiting time to run a unit test to a bare minimum.
2. There exists a whole set of latencies in deployment beyond compilation that also apply to interpreted languages.
3. Developer productivity is not measured in lines of code, but in delivered business value and as such is influenced by many other factors beyond how much time you waste on context switching during compilation. That one is usually pretty minor one: you are the first person in my 25 years of career in IT, who mentions this. Maybe you have some specifics in your field of work where it becomes important, but majority of the industry doesn’t think of it too much (and there is incremental compilation).
> Compiling... it is a terrible UX and interruption of flow.
Compiling a project is only a nuisance if you don't design it around incremental builds and modularity. Otherwise the only thing your build system has to do is to build the files you actually touch, and link the remaining downstream subprojects that depend on it.
One of the first things I don when starting to work on new C++ projects is check build times, and if rebuild times are noticeable when rebuilding subprojects then I determine what can be done to let that cease to be an issue. More often than not, all it takes to get back decent incremental build times is minimizing interfaces, refactoring some includes with interface segregation, peel off submodules from largeish modules, and that's it.
> I truly don't understand why developers put up with the stupidly slow compile times other than having no choice
My money is on the fact that execution speed of a program written in compiled language will run circles around equivalent program in an interpreted language.
Which is true, but doesn't automatically mean that most of the code has to be developed in that compiled language. There is a reason why Python is a popular language for machine learning: the computation is done in optimized native libraries, but the logic can be developed in a more interactive language without a relevant performance penalty.
This also applies to a large amount of other problems, splitting the computation between a slower "high level language" which is suitable for rapid development and low level libraries in a fast compiled language is a good solution.
And of course, you could have fast compiling languages which allow interactive development - just naming Common Lisp as one. You can recompile individual functions witout rebuilding the executable. This could be achived with many languages, but unfortunately it seems that no one bothered to build such systems.
It makes you wish you could perform basically a threaded taks, compile this, execute it, with these parameters or mouseclicks, then produce the results and offer to jump to the last place in code you changed for this.
Parallel builds with makros as afterthought and conclusions to get you back up to speed once they are done
This. I got a standup desk and I find it is easier to do some exercise if you are already standing. Not sure why but it is just easier to do some lunges or pick up a kettlebell from standing position than to get up and do the same exercises. YMMV.
Yeah. At least for me, what I switch to isn't even an ounce more productive than staring at the progress bar.
What I do sometimes is just to go offline. I use iptables to deny outgoing connections on 80 and 443. Then there is nothing to switch to. No emails to check, no nothing. The computer gets really quiet, for a lack of a better word. Uncomfortably so at first, but you get used to it, and after it passes, it's almost calming.
For things like that I tend to step through what I'm going to do after the query finishes. You still keep the context and planning in your head helps with the next few steps.
Thanks for writing this down. This is problematic for me in so many ways. If I have a fast computer, connection, things flow. But obviously that's not always the case. Sometimes something takes 2 seconds. Maybe 5. Or 10. Or a minute. To deal with these miniature disruptions seems really difficult.
Arthur Ashe the tennis player wrote about what an advantage it gave him closing his eyes for c.a. 30 seconds on each change of sides. Cumulatively: about 12 minutes extra rest after four close sets.
This really gets me too. Sometimes, I have to run an integration test suite several times or until a failure in order to confirm the fix works or find remaining issues. It might take up to dozens of minutes, and even longer on a slower PC. For similar situations, I usually keep a backlog of programming blogs to read, but switching back and forth takes a non-negligeble effort.
I’m not so sure about this article. I’ve crafted my daily computing into various buckets not only to stay organized, but to compartment different activities from each other. For example I have a browser profile for NSFW activity that I don’t want anywhere near my professional work related activity. Likewise I have a whole browser profile dedicated to casual surfing of the web with browsing history turned off and all the browsing artifacts get erased upon closing the browser. This isolates sessions so that cookies etc can’t build massive profiles of me. Likewise I have a browser profile where I need to be logged into various services (Amazon, Netflix, Spotify etc) which keeps cookies, and no other browsing is done apart from using those specific sites.
If I need to be productive, again, I context switch into a dedicated workstation that has all my devtools ready, alongside specially configured browsers that I use to test the sites I’m building. These browsers again are separated and highly context specific.
Welcome to modern computing! Context switching is on the menu :)
I have vowed that this year I'm going to use a private profile for Christmas shopping, but the problem is that once I actually buy the present, that's going to be tied into their database whether I use a private session or not.
And since they love to show you ads for things you just purchased, which makes no sense to me at all, then I have to hide my browser windows from that person until December 25th or they'll be able to tell what I got them by looking at the right margin of any page I'm visiting.
Now try context-switching from those to a hour long meandering meeting with no agenda, that you MUST attend in person and pounding away at code on your laptop during the meeting is frowned upon.
I can highly relate to this. There's also the tax of having too many tasks in queue. Maybe that's just me, but if I have to get done 10 different things in the next couple of weeks, my productivity drops to like 40% as my mind keeps switching between all of them.
Having only one project without interruptions, a closed office door, headphones on with music without vocals and my productivity can even surprise me.
> You probably won’t finish this article. In fact, I may have already lost you to another tab in your browser.
I feel called out because that's exactly what happened. I opened the link, switched over to Signal to message a friend, had a shower, and then came back to the article.
Let's see how many tries it takes for me to finish (coming back to HN makes 2 attempts so far.)
I think the toll of interruptions has to weighed against the benefit of the interruption. Sometimes sacrificing your time to help someone get unblocked reaps benefits that make the sacrifice worthwhile. It's not just about your time.
Agreed - while interruptions are a problem, a dev who refuses to engage with the wider team is also a problem. It needs some active discussion amongst the team to balance where to draw the lines.
That picture from 9am to 5pm with so many messaging apps says it all. Too much of the things that give us context is scattered and fragmented in so many places making it so difficult to take action on anything, and consolidating it would be more work than it's worth.
I think a lot of what it takes to be able to do focused work is to get better at actively search for context on what you should work on and why, on what problem is worth solving in what manner. Otherwise, I find myself keeping on searching for something or browsing around to give me a sense of purpose. Once I do, though, I don't want to be distracted from it.
The modern communication tools aren't designed to save productivity. People like things with instant response, so things like commenting on Hacker News or sending a email works instantly, but there is no mechanism for things like telling you that the recipient is busy at the moment and will be available at 4:00 PM when he would start reading the email. Productivity isn't just about cutting down the amount of time needed for a single job, it's about arranging for things to be done more efficiently.
This is why I have hundreds of tabs open. It works just fine if you have multiple things that require incremental progress so long as you complete each increment without context switching.
The solution is probably something along the lines of: become more comfortable sitting and reflecting on the current task. Find ways to remain engaged with the current task during the waiting period (reviewing the code, adding more comments, fleshing out next steps, etc.). Don’t give in to a perception of “justified” context switching.