DEV Community

Cover image for Should I listen to music while coding?
poudyal_rabin
poudyal_rabin

Posted on

Should I listen to music while coding?

When I was a teenager, I used to be a die-heart fan of 80's rock and roll music. I had maintained a handwritten lyrics book of all popular rock songs back then. From AC/DC to Eagles, Bon Jovie to Led Zeppelin, and Metallica to Guns N Roses, I used to have my phone loaded with hundreds of rock ballads.

I was quite obsessed with rock and roll. It used to be a source of dopamine to me. I used to get motivated and energized by those songs.

Now the time has changed, there has been a shift of paradigm. But the love for music is still the same. Starting my day with a simple workout with beast mode workout music is my hack to keep myself motivated to do more exercise. Even during the day while programming, I mostly wear headphones to keep myself focused and to stay away from disturbances.

But a few months back I stumbled upon an article online explaining why listening to music while coding is not a great idea. The logic is that when you are coding you are using your energy on different things - staring at the screen, solving a problem, and listening to music. You are losing energy through the eyes, ears, and, brain. You cannot close your eyes and neither you can turn off your problem-solving background job. One thing you can do is stop listening to music.

I advise using noise-canceling headphones if you want to get rid of background noise. Avoiding music while coding will help you put more energy into solving a programming problem and will make you more productive. If you do not agree with me yet, think about why people meditate with their eyes closed? They save energy doing so; which helps them to use that energy in the brain.

Trying to solve every algorithmic problem in O(logn) is not only the trait of a good programmer, trying to optimize your everyday algorithm crucial too.

Oldest comments (110)

Collapse
 
pierrelampre profile image
Justin Lampe

Here has been my process thus far in regards to music choices while coding.

If I am doing tasks I do frequently, I can listen to any kind of music and be productive. But if I am grokking something rather complex, I will opt for instrumental music. I really like Rachmaninoff and Debussy. I also like vaporwave and dreamwave in these situations as well. Shameless plug If youre asking, "Whats vaporwave/dreamwave?" here is a dreamwave album I released with a friend last year:

ttime.bandcamp.com

There are also moments where I appreciate silence, but its not always an option. With the pandemic my girlfriend is often working from home in the same house as me and a lot of her work is doing zoom calls with clients and verbally walking them through things.

Collapse
 
poudyal_rabin profile image
poudyal_rabin

Hi Justin! Thank you for sharing your opinion. You are absolutely right. Most of the time we need to find the fine balance between if we want to play music or not based on the task we are into. :) :)

Collapse
 
milmike profile image
MilMike

when I code and I know what I am doing I listen to fast paced music, I prefer music without vocals mostly I listen to fast Hardgroove Techno.

When I am thinking about a problem and trying to get a solution I listen to slower paced coding music (you can find them on youtube). Or just silence. As you mentioned noise cancelling headphones are good, even without any audio, just silence.

But once I have a solution or a specific todo, I go to turbo mode with techno ;)

Collapse
 
poudyal_rabin profile image
poudyal_rabin

Hi MilMike thanks for sharing your preference. I will also give it a shot.

Collapse
 
developeratul profile image
Minhazur Rahman Ratul

I love lofi bits so much

Collapse
 
devparkk profile image
Dev Prakash

Even i do

Collapse
 
poudyal_rabin profile image
poudyal_rabin

haha, that's right Amelia. I also think lyrics-heavy songs should be avoided because part of the brain will start processing the lyrics. :D :D

Collapse
 
codemouse92 profile image
Jason C. McDonald

That really depends on the person! Some people are distracted by lyrics, while others (such as myself) are generally more focused with lyrics. It depends on my mood, but there are a lot of days that nothing focuses me better than rock. Other days, it's contemporary. And still other days, it's full-blown metalcore (Wolves at the Gate, yo!!)

Collapse
 
metalmikester profile image
Michel Renaud

I've been listening to music while working since the '90s. Heavy metal music.

If there's no music, I freak out. I'm also treated to construction noises, street noises (a**holes with aftermarket mufflers, emergency vehicles (fire station AND hospital nearby), barking dogs, etc. "Silence" is not a thing here. I also cannot wear headphones if there's nothing coming out of them just for the sake of trying to block external noises. I never even liked headphones. A major advantage since the apocalypse began is that I'm home and don't need to use headphones.

Some of my most productive algorithms work in university was done while listening to Motörhead.

There's no link to that article you mentioned, but I can say this:

Not everyone is the same.

Collapse
 
poudyal_rabin profile image
poudyal_rabin

Hi Michel thanks for your comment. I agree not everyone is the same.

Collapse
 
nhatnguyentim profile image
Hoang Nhat

I also love listening to Heavy metal, currently Architects band. Thanks for sharing Michel

Collapse
 
poudyal_rabin profile image
poudyal_rabin

Hi Sebastian thank you for your insightful comment. I agree with your idea that the O(logn) thing is misleading. I was originally trying to give an analogy that real-life performance can also be improved. :) :)

Collapse
 
iainfreestone profile image
Iain Freestone

If its just music I am fine but anything with lyrics is a no go for me as I find I lose my concentration and start concentrating more on the song than my work.

Collapse
 
poudyal_rabin profile image
poudyal_rabin

I agree Iain

Collapse
 
thebenforce profile image
Ben Force

Since I started working from home I've stopped listening to music, but it was an invaluable tool when I need to concentrate with coworkers around. Also, I found that if I was really concentrating on the problem the music would "disappear" when I got into flow.

Collapse
 
poudyal_rabin profile image
poudyal_rabin

thats right.

Collapse
 
rishitkhandelwal profile image
Rishit Khandelwal

I would say don't, because I find it distracting whole coding. But it can be that ur more focused.

Collapse
 
augustasv profile image
Augustas Verbickas

There is a different variety of white noise, and it feels distracting at the beginning but later I get used to it. Also, it blocks outside noise better than some noise-canceling headphones. I used to work focused when I play white noise, so my brains know that it's time to focus.

Collapse
 
poudyal_rabin profile image
poudyal_rabin

cool!! thanks for sharing Augustas

Collapse
 
poudyal_rabin profile image
poudyal_rabin

ya right Rishit

Collapse
 
augustasv profile image
Augustas Verbickas

For me whitenoise work pretty well, so I could focus on what I am doing. And Pomidoro timer.
During a breaks music for sure to chill.

Collapse
 
poudyal_rabin profile image
poudyal_rabin

hell yeah

Some comments may only be visible to logged-in visitors. Sign in to view all comments.