Sam Howard Sam is a developer at IDRsolutions who specialises in font rendering and conversion. He's also enjoyed working with SVG, Java 3D, Java FX and Swing.

Music and Coding Part 1: Why listen while you work?

3 min read

Listening to music whilst Coding
Listening to music whilst Coding

Listening to music while programming is a topic which seems to pop up every now and again on tech blogs and websites. I’ve generally found them a little lacking in depth, so I’ve decided to write a few articles on the subject, along with plenty of input from my colleagues on how music relates to their work.

So, first up, why listen to music while programming at all?

1. Avoid distractions

The field of psychology has the concept of flow. You’ve probably experienced this when doing your best work – pretty much everything else melts away, and there is only the code.

Then your colleague asks if you watched the football last night, and the world comes rushing back in, completely breaking the flow.

What better way to say “Right now I only talk to machines, not humans” than with a big pair of headphones? Of course, this can also help to block out other noise – sirens, annoying squeaky chairs, your colleague with a cold who insists on loudly blowing their nose every 30 seconds…

Of course, music can also be a distraction, so it’s important to choose the right thing to listen to. One colleague even mentioned they occasionally just wear their headphones without anything playing to dull out background noise and deter interruptions!

2. Keep your mind active

Some tasks, lets face it, are just not that interesting. Testing, for instance, is absolutely vital but is also often a little dull. For times like these, music (or podcasts, or audiobooks) can give the kick you need to keep your brain fully engaged instead of completely zoning out.

3. Trigger flow

Rob Walling from the Startups for the Rest of Us podcast (starting at 7:05) has an interesting way of using music – he’ll loop a single track for hours until he gets into a good flow. He then finds this track can trigger this mental state and get him into flow almost instantly in the future.

This probably won’t work for everyone, though – I think I’d find myself growing to hate the music too quickly! His co-host Mike Taber gets a similar effect from looping a playlist, which might be a little easier to deal with.

4. Get in the right mood

Music is a hugely powerful tool for managing your own mind. I once had a housemate who had a lot of dissertation writing to do and not a lot of time to do it in. He listened to the Inception soundtrack on repeat for days. Other than driving the rest of us mad, the “epicness” gave him the motivation he needed to get it done.

Equally, it’s often hard to concentrate if you’re a bit stressed out. Something like Debussy might calm you down enough to focus on the task at hand.

Another possibility is that the fire alarm went off in your building at 3am last night, the cat woke you up at 5 by sitting on your head, it’s been a long day, and you need something to aid your treacle-thick coffee in the almost insurmountable task of keeping you awake. Something with a faster tempo and maybe some guitars might do the trick!

Other notes

It’s often stated that listening to music can improve people’s mathematical skills. There is research which supports this – in a way. The research in this area has mostly focused on the classroom and not the workplace, and often is more focused on learning musical instruments than listening to music. However, it does seem like there’s a link – whether this applies through to adulthood and programming is less clear.

There has been at least one directly relevant study, though. The book Peopleware by Tom DeMarco and Timothy Lister describes a experiment run during the 1960s at Cornell university. The key part of the experiment was that a group of Computer Science students were split into two rooms, one silent and one with headphones and music. They were given a specification for an algorithm to implement.

There was no difference of note in speed or accuracy of implementation, but there was one big difference – most of the silent group realised that the algorithm they were implementing would just return the input number, and most of the other group didn’t. The book uses this to suggest listening to music is bad for creative thought, but I’m not convinced the research goes that far.

Firstly, comparing to a silent room is not a realistic test of the workplace. Secondly, students who are presumably fairly early in their coding careers may experience different effects working with music to those experienced by full-time software developers. Thirdly, I suspect the types of music on offer may not have been types that were at all helpful.

I’d like to see more research being done in this area, especially since the most relevant study I’ve found is 50 years old! People have greater access to their own music than ever before, and programming itself has evolved considerably since then, so I’d be very interested to see if the results are the same.

Next Time…

So now we’ve done why to listen to music – now our music and coding series continues with a discussion on what to listen to.

Music and Coding Part 2: What to listen to?



Are you a Developer working with PDF files?

Our developers guide contains a large number of technical posts to help you understand the PDF file Format.

Do you need to solve any of these problems?

Display PDF documents in a Web app
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Sam Howard Sam is a developer at IDRsolutions who specialises in font rendering and conversion. He's also enjoyed working with SVG, Java 3D, Java FX and Swing.

3 Replies to “Music and Coding Part 1: Why listen while you…”

  1. So the one piece of research you quote tells you that you’re wrong. The research is from one of the most respected researchers on programmer productivity. And you dismiss it?

    I credit you for citing it. But to dismiss it because you prefer the alternative – not a good way to find optimum solutions.

    I’ve stopped listening to music at work because I’ve found the same thing – no great leaps of insight when the music is on. Music develops the brain, but it takes a lot of the processing power to do so. By all means listen, just not when programming.

    1. I don’t think my concerns about applying the research to this situation are unwarranted, or based on what I’d like to be true – I actually raised a number of specific concerns and mentioned a desire to see further research. I’d be happy to change my opinion if those concerns were addressed!

  2. I agree mostly. But don’t listen to Portishead while you work, it is very demotivating. Save it for the weekends.

Comments are closed.