Listening to Music While Coding: An Opinionated Ruleset
Oftentimes when I see someone coding with headphones on, I wonder: “what are they listening to? And how is it helping them focus?”
There’s an interview with Bjarne Stroustrup (the creator of C++) in which he is asked if he listens to music while coding, to which he replies that he does indeed listen to music often while working, mentioning classical, rock, and country as preferred genres, but that it’s “quite surprising what [he] can actually work with and what [he] can’t. [...] There’s music that sort of ‘takes over’ and you think about the music rather than the code. That’s no good.”
I agree, that isn’t good. After all, music shouldn’t distract a programmer, and maybe I’m missing the target with some people with this one, but music shouldn’t serve to entertain a programmer at work either. It should keep them focused and uninvolved with anything outside what they’re working on. Well, let me rephrase that: it shouldn’t take away their focus, but should rather serve a as a neutral buffer between the outside world and your coding world.
For me, the rules for good coding music are quite specific:
Instrumental music, i.e. music without vocals, is key. Music with vocals tends to produce a similar consequence to productivity as someone talking to you while you’re coding. The words tend to replace whatever it is you’re thinking about, and as a result you find yourself thinking more about what’s being said in the music than what’s being expressed in the code.
Easy listening. You know the type: café jazz, light piano, lo-fi hip hop (I’m looking at you, Lofi Girl). These genres have something in common: they tend to be generic and somewhat repetitive in nature, and this is a good thing, because that means that at no time will the music break away from what you expect it to sound like.
Set it and forget it. This one is less about the music itself and more about how you interact with it. You should never find yourself in a situation where you’re concerned with what to listen to next, and this is another reason why radio-type streams work so well (as long as there aren’t any ads as they violate rule #1 and the latter part of rule #2).
Or forego any of these “rules” so long as the music helps you focus. That's the only rule that matters.