img by Coba

How to Get Into the Zone as a Programmer

Over at LearnItFirst, I often get to be the one in charge of picking out the (background) music that we listen to while coding/designing. Right now, since I'm doing a blog post instead of programming, we're listening to a bit of lively Rod Stewart - Never a Dull Moment (amazon). Not a great album, mind you, but it is what it is - the album playing right now.

One of the fun questions to ask a programmer is, "How do you get in the zone while hacking/coding/designing?" Getting into the zone (and staying in the zone) is a critical piece of success in the development-oriented business. I thought it would be interesting to take a look at specifically what the "zone" is, how it relates to music (since I have a background in music), and see what types of music help us (me) get into the zone quicker and to stay in the zone.

Getting Into the Zone

Jeff Atwood talks about comparing programmers and musicians and how the music can help you get into the zone. Jeff says,

I adore music. I have a vast music collection and I love listening to music and exploring new bands and genres I haven't heard. But I have zero musical ability. So it's not really appropriate for me to comment on this. I've read the same observation expressed in many different places. Enough so that I do wonder if there's some kind of relationship between being a musician and being a programmer.

Okay - here's two subjects that I know quite a bit about: musical ability and programming. Not that many people who know me today know it but I am a pretty good guitar player - and I should be: I spent a decade studying and playing semi-professionally. I started going to school formally at the age of thirteen to study jazz and classical and, after high school, I attended the prestigious Berklee College of Music on a full scholarship. Jazz, in particular, is a type of music where you absolutely must be "in the zone" to excel; you're up there improvising your way through song after song, sometimes with musicians you have never played with before. The more you able to hone into the subtleties of the music and group, the more the group will soar and propel you to new heights... I digress...

Anyway, my point is that "the zone" for programmers is slightly different yet no less important.

The Zone for Jazz Musicians

I played jazz - and I'll be happy to share my favorite groups (then and now) if anyone cares to hear it. The zone that I needed to be in to play jazz required:

  • An idea of what is normal in a given song, situation, combo, etc
  • A deep knowledge of how things should go - how they should sound
  • The technical ability to play any given sound you can dream up
  • An emptiness that allows you to have no preconceived notions of where the music should go; you want to "go with the flow" ideally
  • Ability to understand what the other musicians would add/subtract if I did something unexpected/expected
  • An emptiness that allows you to not play things you've played or heard before; to just "be" (you don't want to wind up playing rote licks or patterns that you've practiced)

There is more, of course, but if you have the above taken care of, you are absolutely free to play anything you hear in your mind instantly. It's complete and utter freedom.

The Zone for Programmers

For me to get in the zone as a programmer requires a lot of the same ideas, just in a different context:

  • An idea of what is normal in a given application, situation, user interface, etc
  • A deep knowledge of how things should go - how they should feel
  • The technical ability to code any given solution you can dream up
  • An emptiness that allows you to have no preconceived notions of where the app/logic should go; you want to "go with the flow" ideally
  • Ability to understand what the other developers would add/subtract if I did something unexpected/expected
  • An ability to blindly (and correctly) code solutions that you've seen elsewhere or used previously

Notice that the only real difference is the last bullet point in each. In programming, you want to have a working body of knowledge that you can use over and over again (whether it be through inheritance, code re-use from other applications, copy/past via scripts) but in jazz you want to be completely original as much of the time as possible. This is a fundamental difference between the two: as a jazz musician, I pretty much had to severely limit the music I heard from other people lest it "taint" my originality. In music, too much originality can lead to productivity loss at best and security flaws at worst.

How I Got Into the Zone as a Musician

It all started with the pre-gig mentality: practicing the songs, practicing at multiple tempos so that there were no distractions, and having rehearsals so that I could get comfortable with the sounds and the musicians. On the bandstand, it was important that I not drink too much caffeine or alcohol (both of which impair that ability to empty your mind), closing my ears to outside noises (a dropped glass, for example, can ruin your concentration) and that I closed my eyes when I was really in the zone so that I didn't get distracted by the audience.

To get to the point where you can concentrate while onstage with a band takes practice - a lot of practice actually. Specifically it takes you being able to get in the zone while you're alone at your house practicing your instrument. You must develop that as a skill - it's partly what you do while you spend your 10 hours a day playing. The more quickly you can get into the zone while alone, the more quickly you can do it while onstage even with all the distractions.

How I Get Into the Zone as a Programmer

Sometimes it's a matter of just listening to the right music and I work on interesting problems. Other times it requires turning the music off. And sometimes, the only way to get into the zone as a developer is to leave the zone and the computer behind, grab a pen and some paper, and go work out my problems on paper. Once I have the solution, then I can come back to the computer and zone out for 2-6 hours at a time.

In the programming arena, eliminating distractions is critical for me to (a) get in the zone, and then (b) stay in the zone. Shutting down Outlook (my email client), closing IM (instant messaging), setting the phone on vibrate - all of these help me stay in the zone and, once I'm there, I can often stay for hours at a time. Those of you have been in the zone will know the feeling that, all of a sudden, you think your bladder is going to burst! "Oh... I guess it was about six hours ago that I last stood up. And those three bottles of water in between can't help but make things worse."

Music and the Programmer

I can't tell you how to get yourself in the zone; I can only tell you what works for me and perhaps there are corollaries that you can draw that ultimately will help you figure out what works best for you. Here's how it works for me:

  • Menial tasks: any and all types of music
    • Lyrics are okay and interesting music is okay since it can't distract me from my copy/paste fest
    • Good musicianship is fine as well since I don't have to focus 100% of my attention on the task at hand
  • Mentally challenging tasks with lots of problem solving that has already been done; now it's just time to code it up
    • Now I need something without lyrics - dance/trance/electronica/jazz
    • I need something with a beat that drives forward and keeps me moving - no slow songs or ballads
    • I've never been able to program to classical music despite the fact that I love it. It's just either (a) too up/down/dramatic with the volume, (b) too boring, or (c) too exciting aurally. One of my favorite pieces is Bartok's Concerto for Orchestra but I'll be damned if I can code by it; I can't quit listening long enough to code!
    • If I listen to jazz, it has to be something I don't particularly like (for the same reason as above). I have a tendency to memorize music and, if I find myself singing along, I've lost the game.
  • Mentally challenging tasks with lots of problem solving that hasn't been already completed
    • No music - too many distractions
  • Pure problem solving
    • No music
    • No phones
    • No email
    • Shut the blinds

Obviously lyrics don't work for me as I get deeper into a problem.

Some of My Favorites to Program By

I put links, where appropriate, to emusic.com and amazon. When it comes to particular albums, I'm usually a fan of the latest of each artist (or else they probably wouldn't be on the list). When that's murky, I've included a specific album.

Dance/Trance/Electronica:

Jazz:

World:

I think most people know what they like in Rock, Hard Rock and Hip Hop - it's an area where most people spend more time than in Jazz, for example, so I'll not list those here.

And, for the record, we've moved on to Kim Wilson's Tigerman.

authors
scott whigham
grant moyle
chad weaver
recent comments
  • chrsitian louboutin: 2010 days good intentions of the leisure shoes picture warmer read more
  • Matthew Cadiz: Great post I must say.. Simple but yet interesting and read more
  • Julieann Martinis: I need to assert, that in all the time I've read more
  • environmental articles: Apple now has Rhapsody as an app, which is a read more
  • Lakeshia Urquilla: I've never read an organized article like this one before, read more
  • Luis Ridgeway: I usually read the content on sites previous to I read more
  • Houston Flood Insurance: Wonderful to read! read more
  • Car Covers: It can be good to undoubtedly dig up a web read more
  • Dani Gremo: That is a very interesting post, Patents are needed for read more
  • Hello Kitty: Wow this takes me back. Nice blog. read more