News for hackers. Stuff that matters.
Re:Context switching costs more than we give it credit for by saurik on Sunday January 17, 2021 @10:14PM (#25817718)
There was a semi-famous study (one that I feel every developer should have at least considered) that gave software developers a problem to code in the form of some convoluted set of steps, and they were either assigned to listen to music or not to listen to music. There was (usefully) no difference in the correctness of the implementations, but people who listed to music reported more subjective happiness / less boredom doing the task... only... they were also much less likely than the people who did the task in silence to notice that all of those steps collapsed down to "return a constant number".

I personally feel like there are different components of my brain and some of them just want to do something, and if I don't "distract" them then they do something arbitrary and maybe in turn distract me... but if I need them, and they are busy deciding some music I am listening to, I lose out on the maybe-even-often subconscious processing they do that gives me valuable insight. I thereby find some (mostly useless) tasks easier if I am seriously even playing a video game with a targeted skill while doing them (people hate me in meetings sometimes ;P), or maybe listening to music, but if I am doing the hard coding work I "should be doing" I just can't :(.

Re:Context switching costs more than we give it credit for by civilized on Sunday January 17, 2021 @10:29PM (#25817776)
I was very curious to find more info on the constant number study. So far I found this older HN post, which is itself quoting from an apparently famous book, which according to some replies was BSing the whole thing https://news.ycombinator.com/item?id=1995239
Re:Context switching costs more than we give it credit for by nulbyte on Sunday January 17, 2021 @11:29PM (#25818163)
I couldn't find anything on a study at Cornell University, but I did find mention of a study at the University of Windsor that included 72 students in three groups: a control group, a group that listened to music before, and a group that listened to music before and during.

The results[2] are published in an article behind a paywall, but they give details of the two tasks presented to the subjects, neither of which involved actually writing code. One was a 15-minute task of locating syntax errors, another was a 20-minute task of locating logic errors.

[1]: https://www.gwern.net/docs/music-distraction/2005-lesiuk.pdf [2]: https://www.tandfonline.com/doi/abs/10.1080/08874417.2000.11...

Re:Context switching costs more than we give it credit for by captn3m0 on Monday January 18, 2021 @10:02AM (#25822404)
Re:Context switching costs more than we give it credit for by Jaygles on Monday January 18, 2021 @09:44AM (#25822238)
For me it depends on if the music has lyrics or vocals in it. Someone speaking or singing is the factor for whether my brain expends cognitive effort in listening. I just can't help but try and pick up on words and discern what the meaning of them are.
Re:Context switching costs more than we give it credit for by FullMtlGtar412 on Monday January 18, 2021 @12:16PM (#25823959)
I actually have to get even more specific than this (at least prior to being diagnosed with ADHD in 2020 and getting Vyvanse for it).

If I need a mood boost or something to get my body "moving" in my seat and keep me from mentally wandering, I'll throw on stuff I really know and love. Usually I'm doing menial tasks or simple coding.

If I'm having a hard time focusing and need a distraction for some parts of my brain but not all of it, I have a "deathcore" (really more like melodic (tech) death metal) playlist where most of the songs sound very similar and you can't understand a thing the vox are saying.

Typically if I'm super tired AND need to block out the outside world but even hard to understand screaming won't cut it, I have to resort to either instrumental metal or LoFi hip hop beats to study to.

If I'm currently listening to music, I really only do a full stop/pause to focus if I notice I've run a breakpoint three times and have no idea what I've been stepping thru, or if I'm trying to refactor or write a fresh, new logic flow and just can't get my brain focused enough to "check it" for all possible paths. That's when I cut the feed, double-time my focus, and once I'm convinced it's "safe" I can hit play again.

Brains are weird and finicky I tell ya.

Re:Context switching costs more than we give it credit for by kortex on Monday January 18, 2021 @01:33PM (#25824900)
Do you notice your musical tastes at a given moment are modulated by Vyvanse levels? I find as I ratchet up the dose, or get very deeply focused on a task, the complexity of the music I listen to goes down. Morning, before the meds kick in, I like high-complexity high-energy stuff: eurobeat, electroswing, hard bop. That gives way to psytrance, then house, then techno, with high-tech minimal being my go-to when I am really firing on all cylinders. Then into lofi, downtempo, ambient, then silence for when I'm overstimulated.
Re:Context switching costs more than we give it credit for by carschno on Monday January 18, 2021 @11:28AM (#25823343)
For me, not being a native English speaker, it "feels" much easier to listen to music with English lyrics while working effectively on other cognitive tasks like coding, compared to listening to music with vocals in my native language.

On the other hand, there are several other factors, like how tired I am, how hard the foreground task is etc., so it is hard to pin-point it specifically to the lyrics language.

Re:Context switching costs more than we give it credit for by ImprovedSilence on Monday January 18, 2021 @11:38PM (#25830050)
This 100%. I don't speak Spanish, but my god, Latin pop just gives me the flow.
Re:Context switching costs more than we give it credit for by corobo on Monday January 18, 2021 @11:10AM (#25823142)
For me it's how long I've been doing it.

If I've just started both are probably going to be good results. If I'm 4 hours in the music one will probably do better because I've not wandered away from my desk distracted by a shiny pen.

Re:Context switching costs more than we give it credit for by _rs on Monday January 18, 2021 @01:27PM (#25824833)
I've found for this reason I can never listen to new music I'm excited about when coding (i.e. a new album release by an artist I like), but I can listen to the radio and music I'm already familiar with without an issue.
Re:Context switching costs more than we give it credit for by jrib on Monday January 18, 2021 @10:40AM (#25822773)
Same for me. I can't code as effectively with lyrics in the music. Postrock hits the sweet spot for me.
Re:Context switching costs more than we give it credit for by andreareina on Sunday January 17, 2021 @10:29PM (#25817783)
Do you have a link or pointer to the title/org/authors? It sounds interesting and I'd love to read it myself. Absolutely I definitely feel like I'm not reasoning as well as usual when I've got something on.

[ETA]

According to [1] it's described in "Peopleware"[2]. Apparently needs corroboration (see sibling reply by 'civilized)

[1] https://www.quora.com/Does-listening-to-music-while-programm...

[2] https://en.wikipedia.org/wiki/Peopleware:_Productive_Project...

Re:Context switching costs more than we give it credit for by tomjen3 on Monday January 18, 2021 @06:40AM (#25820727)
I wonder if that depends on whether the programmer gets to choose the music or not. I often hear music I know backwards and forwards or just straight up instrumental but if you put the pop 100 on I would get distracted.
Re:Context switching costs more than we give it credit for by netizen-9748 on Monday January 18, 2021 @09:39AM (#25822180)
This is something I have noticed as well, if it is music I've heard many times before it is far less distracting than something more novel.
Re:Context switching costs more than we give it credit for by Cyberspy on Monday January 18, 2021 @03:28PM (#25826230)
Reading about this study and the experiences described in other comments, it seems the experiment is a bit limited in its scope.

The effect of music depends on the person, the type of music (lyrics or instrumental - even if there is applause or not), how well the person knows the music and, of course, the task itself and its complexity.

Until there's a way to test all of those permutations, I think the best we are going to do is rely on all our anecdotal evidence, as it affects ourselves.

Re:Context switching costs more than we give it credit for by bonfire on Tuesday January 19, 2021 @12:11AM (#25830215)
This is similar to the experience of driving a car and listening to music at the same time. When you are in a tight situation, like a very busy road or a narrow street with lots of traffic you'd usually stop talking to the passengers or turn the radio down a bit to "concentrate". It's because you want to use all the mental capacity at that time.
Re:Context switching costs more than we give it credit for by geoduck14 on Monday January 18, 2021 @11:06PM (#25829880)
Did the group without music have kids screaming in the background? Cause if they didn't, I'm not sure it is a realistic experiment.