Hacker News new | past | comments | ask | show | jobs | submit login

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.


Further reading on this idea: https://en.m.wikipedia.org/wiki/Iatrogenesis

I was diagnosed with ADD as a kid, it make my life considerbly harder and was not to my benefit. Once I left school the "disease" evaporated.


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


I’m working from home and this brief breaks I focus on having a drink of water, or I get out of my chair and exercise for a minute or two.

I find the physical and mental tasks context switch is easier than hoping between two cognitive tasks.

I speculate without data that interruption of cognitive tasks with physical exercise is beneficial.


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.


I'm reading this comment, nodding in agreement, as I wait for my db sync script to complete.


So you context-switched to read HN and even nod your head?

Hmm. Have you gone down the rabbit hole of reading many comments and bobbing your noggin ?


> So you context-switched to read HN and even nod your head?

Indeed.

> Have you gone down the rabbit hole of reading many comments and bobbing your noggin ?

In that particular instance, no, I dodged the HN distraction bullet. But there are no guarantees in life.


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.


I did a bunch of optics R&D, so those 1-2 minutes were spent waiting in a lab with the lights turned off and a warning light flashing over the door.

You know where I'm going next. Actually, I found that a quick snooze didn't affect my flow at all.


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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: