Music while coding: placebo or truly helpful?

Let me set the scene: It’s 11pm on a brisk Friday and you have a project due Monday morning. The text editor is as colorful as a christmas tree and there’s a cup of coffee just off to the side. A long crack of your knuckles brings phalanges to keys. It’s the calm before the storm and all is quiet. Too quiet. You open your music program of choice and start listening to a playlist comprised of Brian Eno, Aphex Twin, and Tycho. Switches meet circuits and code starts to fill the screen. Alternating between the coffee and debugging, you’ve hit a wall. There’s a bug whose origin isn’t exactly clear. You stop the music, you need to think.

Was it necessary to stop the music? Was it even helping in the first place?

The answer isn’t definitely clear but some background information can help understand it. Software engineer William Narmontas breaks it down into an easily understood idea. “Programming falls into two camps, creative and repetitive”. When writing code is in the creative state, you’re trying to solve a problem. Typically, the problems you face are ones you haven’t encountered before and are unsure about the best solution. This is where silence is key. Not only does silence relive stress and tension, it helps to replenish our mental resources. Long story short, our brains can do more and better work when the amount of sensory input is limited. Next time you encounter a bug, try turning the music off. Enjoy the quietness and try to solve the problem.

The other side of programming, as mentioned, is repetition. No matter if it’s declaring includes and setting up the int main or writing a nested for loop, you can pretty much write them in your sleep. These aspects of programming do not require much brain power and are the perfect opportunities to listen to music. You, the programmer, want to finish these parts as quickly as possible to allow time for solving the more complex problems involved in the project. Listening to music makes repetitive tasks more enjoyable by increasing happiness and efficiency. This bump in productivity can be attributed to increased mood from listening to music, according to some recent studies. Just starting off the project and creating the outline is the perfect time to let the music flow.

So to answer the question in the title, it depends. Find yourself working on a difficult problem/bug? Turn off the music and use the silence to your benefit. Writing the basic setup for the project? Put those headphones on and enjoy the musical stylings of Trent Reznor and Atticus Ross to help grind through the monotony of declaring your variables.