When we sit down to write code we all desire coding nirvana, where the world around us melts away and we achieve an inner peace, the code appearing to write itself.

One of the obstacles to reaching such a relaxed and focused mental state is distraction from noise. Like a toddler incessantly poking your arm, it robs you of your attention.

This is why headphones are essential gear for programmers.

They enable us to shut out the world and concentrate on the code, making coding nirvana easier to attain. But with so many different types of headphones on the market, how do we know which ones to choose? Are some better than others for programmers?

# Types of headphones

There are four different types of headphones, and knowing how these types affect sound isolation is essential for understanding which are more suitable for programmers.

Earbuds sit loosely in the outer-ear facing, but not inserted into, the ear canal. They provide almost no isolation.

In-ear monitors are inserted into the ear-canal, forming a tight seal, passively isolating a lot of external noise.

Supra-aural headphones have small ear pads that sit on the ears, passively isolating some but not all noise.

Circumaural headphones have large ear pads that encompass the ears, forming a tight seal, passively isolating a lot of external noise.

Supra-aural and circumaural can also be either open or closed, and this has a dramatic affect on sound.

Open headphones have an open back which allows sound to enter and exit the headphone. This improves sound quality, but also reduces isolation for the listener, and subjects those around you to your music.

# Active noise-canceling

Headphones with active noise-canceling technology use microphones placed around the headset to pick up external noise, and use digital signal processing to cancel it out.

It would seem natural to assume that noise-canceling headphones offer the best solution; however, this isn't necessarily true.

They shine at canceling out low-frequency repetitive sounds. Background noise like the hum of an airplane engine or air-conditioning fall into this category. It's surreal when you take off active noise-canceling headphones and the background noise you didn't realize was there floods back in.

However, active noise-canceling headphones are poor at removing high-frequency and irregular sounds. The unpredictable sound of people talking or crying babies are good examples of this. The sound is dampened, but it's still there.

Given that programmers are distracted by talking colleagues and the click-clack of keyboards, especially those unfortunate enough to work in the nightmare open plan office, active noise-canceling headphones don't offer much noise isolation benefits over their passive isolating counterpart.

You're also paying a premium for the noise-canceling technology. When compared with passive isolating headphones in the same price range, both the sound and build quality suffer in the active noise-canceling pair.

Take the market-leading active noise-canceling Bose Quiet Comfort 35 ($349.95) and the passive noise isolating Bower & Wilkins P7 ($399.99) as an example. While the Bose headphones aren't by any means poor quality, the plastic and "protein leather" construction feels much less premium than the aluminum and sheepskin leather of the P7. And the sound quality is the difference between good and great.

# Sound shape

Reaching coding nirvana can also depend on the shape of the sound the headphones produce. It doesn't help if you're isolated from your environment but the sound doesn't takeover your senses, pulling you in.

The shape of the sound is described in terms of which frequencies are given more emphasis. Warm-sounding headphones emphasize the bass whereas bright-sounding headphones emphasize trebles.

In between you have neutral headphones which have an overall balanced sound, V-shaped which emphasize both bass and treble, and others that focus on the mids.

The sound shape that helps you reach coding nirvana will depend on the music you enjoy and your preferences. Try as many headphones as possible to discover what works for you, and what doesn't.

# So what's best?

IEMs and closed circumaural headphones provide the best passive noise isolation of the four types of headphones, which makes them ideal for programmers.

Active noise-canceling is a fascinating technology, but it doesn't help any more than IEMs and closed circumaurals at isolating sounds that programmers have problems with.

Given that IEMs and circumaurals also offer superior sound and build quality in the same price range, it makes it difficult to recommend active noise-canceling headphones for programming.

However...

Headphones are about as personal as it gets. What sounds ground-breaking to one can make another's ears bleed (not literally). And if you travel, perhaps the noise-isolation is something you can't miss. The only way to find out is to get out there and try them all out.

Hopefully this article gives you something to consider while you search for the perfect headphones. After weeks of research and trying out several headphones, I settled on the Oppo PM-3 and couldn't be happier.

For more information about headphones, I highly recommend you check out innerfidelity.com and head-fi's Headphone buying guide, as well as /r/headphones.