DEV Community

Claudio Bernasconi
Claudio Bernasconi

Posted on • Originally published at claudiobernasconi.ch

Should You Listen to Music While Programming?

Do you listen to music while working on your programming project? Is it okay, helpful or a bad idea? Are you an enterprise developer and are you able to make this decision or are you forced to sit in a quiet environment or listen to your boss’ favorite radio program?

I recently discussed the topic, and I was not sure on which side to put myself. From time to time I like having a quiet environment which lets me focus on a problem and dive deep into the internals of any given code.

On other days, I like having music in my ears. Sometimes it helps me concentrate on a specific problem and helps me avoid other distractions.

In this article, I’m going to discuss the pros and cons of listening to music while programming. Some information is based on a bit of research, and I also give my own opinion on the topic.

Pro

Listening to music can help you get into the “zone”. It’s a powerful state most developers hit from time to time where the world seems to be irrelevant and the only thing that needs to be done is the problem you’re working on.

Music also helps you reduce the impact of the environment on you. If you’re working in an open space office or in a noisy restaurant it might be helpful to reduce the noise around you and by listening to music you have control over what you hear.

Music can motivate you to get things done. Sometimes you think hard about a problem and cannot decide on which solution fits best and you end up in a deadlock in your brain. Music can help you get things done. The nature of tracks ending and rhythms changing can urge your brain to make decisions. I do not have scientific evidence for this, but I once read about it and I think it’s true for me.

You can block off co-workers. Seriously, depending on your office situation it can be helpful to isolate you against people lurking around and asking you stupid things. I am all for working together as a team and if someone has an important question he or she can always approach me at my desk. But how often people stop by just to talk to you about their weekend and other non-work related things? It’s happened to me, and I am sure, it happened to you.

Contra

One of the most heard arguments against listening to music while working is that you get distracted from work. Indeed, if most of your day consists of changing tracks, adjusting volumes, managing your playlist, and finding the newest music to listen to, it can be a big distraction.

Some people also claim that your brain cannot do multiple things at once and therefore it is generally a bad idea to listen to anything while doing work.

Different types of music

An interesting topic is the type of music you listen. Usually, I listen to different music while working than I listen to while working out or doing something else in my free time. It is personal preference, but I have my logic why this might be a good thing.

First of all, I do not care about the music itself. If you listen to the new album of your favorite interpret, I am sure you want to catch more of it than just a few bits. Therefore, you should listen to it in your free time.

In general, music with fewer lyrics tends to work best for me. If there is too much singing or rapping going on my brains needs too much energy to absorb the lyrics.

Office rules

I am not a fan of rules. It is especially true when it comes to working. In my opinion, every person knows himself best and is mature enough to do the right thing at the right time. But some offices have rules about using headphones or listening to music.

If the rules fit you, perfect, if not, I would try to speak up about it and provide arguments on why listening to music would help you do your job better. Sometimes you do not have the freedom to decide. You either accept it, or you move on.

Randomly generated playlist

I like the Flow functionality of Deezer. It’s an algorithm which selects music tracks for you. I think it’s trained based on my playlists but also on the music I listened to in general on the platform. It creates a good mix of different music styles which can run in the background and which help me to focus on my work.

I do not have to change tracks, and there are also new tracks mixed-in which makes it enjoyable even after a few hours or weeks. There is always something new in there, while some of the well-known tracks will be repeated over a few days.

Music to code by

I have never tried it, but as a regular listener to the DotNetRocks podcast, I know about Carl Franklin’s Music to Code by project. I’ve heard many success stories from people listening to those tracks which are “scientifically designed to quickly get you into a state of flow and keep you there”.

As I wrote above, I have not tried it yet. Do you have any experience with it? Let me know in the comments below. It might be worth checking it out in the future. I like the idea behind the project.

Conclusion

There is no right or wrong. There is no yes or no. If it makes sense for you to listen to music while working, you should do it. Some people will benefit, others don’t.

In my opinion, it’s up to you, how you want to work. With music, or without. The only important thing is that you make your decision on your own and that you make the most appropriate decision. Everyone is different.

Maybe it makes sense to listen to music for specific tasks while it’s best for you to have absolute silence when working on something different? Who knows?

There is no general answer to the question of whether you should listen to music while programming or not.

Let me know in the comments below how you deal with listening to music while programming. I am curious about your experience!

Other Resources

This article was originally published on claudiobernasconi.ch on February 20th, 2019.

Top comments (53)

Collapse
 
elmuerte profile image
Michiel Hendriks

Silence. That's what I prefer.

I only play music when I have to cancel out other noise. The music I play is generally music from video games. This music was designed to be supportive of the environment rather than being in the foreground.

Collapse
 
lkreimann profile image
Lea Reimann 🦄

That's a great idea!

I have a very noisy environment at work which makes it hard for me to concentrate. Since I'm a total metal head I tend to listen to this stuff at work but it distracts me a bit too much. I'm going to try music from video games to listen to at work soon!

Collapse
 
doubleedesign profile image
Leesa Ward

I'm also a fan of film/TV scores for this.

Collapse
 
cameronblandford profile image
Cameron

I’ve always been a huge fan of brain.fm. It generates ambient music that helps you focus and it works bizarrely well. However, it’s definitely a little draining in a way that listening to your favorite soundtracks isn’t!

Collapse
 
claudiobernasconi profile image
Claudio Bernasconi

I've never heard of brain.fm. Thanks for sharing. I might give it a try to see if it's something for me.

Collapse
 
edwinthinks profile image
Edwin Mak

Double up on brain.fm. One thing I really enjoy about this product is the music has a timer 30 mins, 1 hour, 2 hours. I utilize the timer to prevent myself from overworking and remind myself to take breaks =).

Collapse
 
israelmuca profile image
Israel Muñoz

It totally depends on what I'm working on...

New/Hard tasks

  • Videogames music (TLOZ!)
  • Classical music
  • very soft House music

Repetitive/easy tasks

  • Whatever playlist even the ones above

So I guess it all depends on the tasks for the day...

Collapse
 
claudiobernasconi profile image
Claudio Bernasconi

Appealing thought about when to listen to which genre. Great idea, thanks for sharing, Isreal!

Collapse
 
chatziiola profile image
Lamprinos Chatziioannou

Read a couple comments that highlighted the use of YouTube music while working... It seems to me that listening to YouTube, even though it gives you an infinite selection of songs, is not ideal, primarily due to the lots of advertisements. I am a high school student and I am sure that I do not spend as much time coding for personal projects as the professionals here, but still, many times I have found myself suddenly distracted by an annoying ad playing over and over again.

Also, I have some doubts on whether listening to your favorite artist is something that should be avoided while working;catching a phrase and clearing your mind for a couple minutes is an interesting recipe for increasing productivity...

Collapse
 
claudiobernasconi profile image
Claudio Bernasconi

I also think that YouTube is not the best solution for me, but if it works for others - why not? I also believe that the ads can distract and, depending on the playlist you find yourself skipping songs a lot which means distraction from your primary task.

Yeah, I most of the time do not listen to my favorite artists while programming. Again, this is personal preference, and I love reading all the comments about how people approach their programming sessions.

Thanks for sharing your thoughts, Lamprinos.

Collapse
 
chatziiola profile image
Lamprinos Chatziioannou

It was my pleasure, Claudio, loved the article and the discussion that it sparked! 😉

Collapse
 
nelo_mf profile image
Manuel Fernandez

It used to be very effective for me, but now I've realized that I spend more time than i'd like switching tracks on Spotify.
I usually turn on the music when i'm feeling a bit tired and i've already reached my coffe limit for the day (which is two mugs a day if you're asking).

Collapse
 
claudiobernasconi profile image
Claudio Bernasconi

In my opinion, when using services like Spotify, the end goal should be that you don't have to skip tracks anymore. There are excellent algorithms which should learn what you like and what works for you. The longer you use a particular service, the better the song list should become.

Do you experience something else or do you agree?

Collapse
 
nelo_mf profile image
Manuel Fernandez

Totally agree, somehow the suggestions I get from Spotify are a bit flawed. Guess I should listen to more Spotify radios and actively like and dislike songs in order to "curate" my library... but my manager would choke me with my own headphones cable hahaha

Collapse
 
strahinjalak profile image
Strahinja Laktovic • Edited

I like to listen to techno and trance for getting in the "zone" that you mentioned, and it could really put me through hours of work without me even noticing. There are days when I'm just tired and could enjoy ballads. When there is something to be solved, that requires my full attention, I turn off the music, however, I might just keep the earphones on. :)

Collapse
 
claudiobernasconi profile image
Claudio Bernasconi

It seems like you are very aware of how you use music while programming. Glad to hear that is works out for you.

Collapse
 
strahinjalak profile image
Strahinja Laktovic • Edited

Yeah, thanks. Actually i really like your topic and I could go on and on about it because i was experimenting with the music a lot during work hours, first at school, college, and now at work. There are dozens of genres, playlists and types of music that I like and use in such manner. However that requires its own discussion and I don't want to bother you with details. I'll give one interesting example, however, since we are on topic. I used to listen liquid drum n bass playlists only while practicing for math exams, can't seem to remember i played it a lot during work :)

Collapse
 
mnlwldr profile image
manuel

I prefer music while coding. I switch between somafm's groove salad, defcon radio and Deep Space One station.

somafm.com/groovesalad/
somafm.com/defcon/
somafm.com/deepspaceone/

I made me a little bash script to switch between stations:

somafm

GitHub Gist

Collapse
 
fhammerschmidt profile image
Florian Hammerschmidt

Depends on my mood or if I really need to concentrate. I often start with youtube.com/watch?v=RYDUQx0iIN4 to get in the zone. After that, anything instrumental works, mostly electronic things like MDK.

For refactoring, I really like things like the DOOM 2016 soundtrack, just cutting through code instead of demons.

Collapse
 
theboxfactory profile image
Ian Clark • Edited

I find listening to music very helpful, but would make a couple of observations:

  • Music without lyric seems to work best for 'flowing flow' with slower paced electronica, ambient and classical proving popular choices

  • Playing music at a volume where it is noticeable by it's absence and not by it's presence, will also help you attain and maintain deep concentration.

Recommended Sources:

Music For Programming - musicforprogramming.net - Excellent electronica mixes
Generate FM (generative.fm/) - Generative ambient (includes open-source code!)

Collapse
 
damcosset profile image
Damien Cosset

I usually have two things that seem to work for me.

  • The first one is to pick a song, doesn't really matter which one it is, and to just listen to it on a loop. After 10 minutes, the song is just so repetitive that I don't pay attention to it anymore and I'm not distracted by the outside world. It seems to act as a white noise.
  • The second thing is classical music. Like you said, no lyrics might be better. I don't quite know why, but it seems to be the best genre for me when I want to get coding.
Collapse
 
claudiobernasconi profile image
Claudio Bernasconi

There has to be something about classical music. You're not the first and undoubtedly not the last one to bring that genre up when it comes to focusing on programming work — excited to see that it works for you!