Some call it eliminating distractions. Some call it flow. Tuning out of your immediately surroundings has been shown to increase focus on internal thinking processes. In this post I’ll dive into both the neurological components as well as folk-advice surrounding this phenomenon.
Working memory is a well studied component of brain physiology and normally associated with the prefrontal cortex. If you, for example, try to memorize a list of random words and repeat them from memory, then you will likely try to put them into working memory. However, this probably won’t allow you to remember more than a few words at a time. Working memory has a very limited capacity.
Memory athletes get around this limitation by using a technique usually called memory palaces. This allows them to offload the majority of memory requirement to spatial memory, which is very closely associated with working memory. These athletes “walk” around their internal concept of a palace and “place” certain words or objects into a location where they will remember it at the right time. When used correctly this technique can add huge multipliers to the ability to remember what would otherwise be random information.
Programmers use a similar technique to remember and navigate code. However there are limitations, namely that working memory is not completely removed from the picture. Working memory is full of all the things that you are consciously aware of at any given time. That dog sniffing around, the music your desk-mate is listening to, the meeting on your schedule, and everything else that you may be worrying about. These things fill your working memory, and are a huge drag on any attempt to work with the code in your head.
Too many simultaneous distractions will effectively block any attempt to reach the glorious flow state of mind. Studies have also shown that once an individual is knocked out of a flow state of mind, it can take up to 20 minutes to get back. Losing concentration can have significant impacts on worker productivity. This is where headphones come in: for programmers wanting to tune out of distraction and stay in the flow, music is a great release and safety measure.
On another note, this problem is sometimes less significant in senior programmers, because their understanding of a project or environment has since moved from spatial short-term into spatial long-term memory; the effect being that it is much easier to recall these memories without going into a trance.
So to reiterate: programmers are easily distracted, headphones eliminate some distractions, thus headphones make programmers happy.
Personally I have music on almost all the time, with or without code. I just love music.