Learning to Code and Learning an Instrument

Hands on Piano

When I was little I learned how to play the piano. I had reading music, proper hand positioning, and playing Minuets drilled into my little skull. My piano teacher was a former funeral home director and a jazz musician. He had all the seriousness of a man who dealt with the bereaved, but the musical chops of Little Richard. My piano lessons were an exercise in perfection and rigidity and there was no room for individual thought. Sometimes I would decide that Beethoven, Mozart, or Grieg had it wrong and would exercise my freedom of expression to make it sound “better”; my piano teacher hated that. I was more interested in writing my own songs than I was in playing Beethoven’s or Bach’s. Eventually I stopped taking piano lessons and switched to drums and finally guitar. Lately I’ve been thinking a lot about the similarities between learning to play piano (or any instrument) and learning to code. I think both involve similar approaches in regards to lessons, techniques, and skills.

Here’s why:

1. An entirely new vocabulary and way of thinking is introduced.
2. Muscle memory.
3. Combining simple elements to create complexity.
4. Persistence

New Vocabulary

Learning to read music teaches you how to think outside of your comfort zone. You’ve got time signatures, keys, notes, marks to denote staccato or a phrase that is largo. What’s that you say? Why the Italian? The language of music is Italian so you also have to know what it all means. The first year or two of music lessons includes learning to decipher this new language. Once you’ve figured it out, however, it opens up a new world. You can sit down with sheet music and it gives you an instruction pamphlet for how to play. Coding has its own unique language as well. A language that is filled with “a-ha” moments when something suddenly hits you for the first time. It’s just like music in that everything is descriptive in regards to what it does and why, but you still have to learn and translate the basic vocabulary.

Muscle Memory

My first piano lessons involved drilling proper hand positioning. I practiced until my hands ached and then one day, they stopped hurting. What’s most amazing to me is that two decades after I took my last piano lesson I can still sit down and my hands know exactly where to go and how to rest. The muscle memory is even there to play scales in almost every key. I don’t know how I know how to do it, but somehow I do. I’ve begun to notice something similar as I continue to learn how to code. My fingers just know what to type and where to go. It’s as if muscle memory is taking over and I’m using less brain power to process the basics.  

Combining the Simple to Create the Complex

In it’s simplest form music is just notes. Add a few notes together and you have a chord. Play a few chords together and you can create a song. It’s all about putting together the basic building blocks one note at a time. Coding is the exact same way. When I first started playing piano it was extremely frustrating because the process seemed to move so slow and I really wanted to just play a certain song. My piano teacher would hold me back while unbeknownst to me he was leading me down that path so that when he said, “ok, learn this song” I already had the skills to put it all together. I feel the same way about learning to code. I really want to build an application or do this specific thing. What I’ve learned is that if I take my time and understand the individual components behind the song or the program its help me build even better songs/programs. I’ve certainly hacked my way around building a basic Ruby on Rails app and after a few hours got it “functional”, but going through and learning the proper way to do it opens up the inner workings and makes fixing issues easier and faster.

Persistence

Learning to play any instrument takes persistence. Playing guitar makes your hands just plain hurt. You have to stretch, bend, and hold down strings to try to get the right chord. After you’ve got that one chord you have to learn a bunch more and then figure out how to transition them. It’s easy to give up and I know a lot of people with guitars who have never been able to push past that first painful month (it honestly only takes one month to push past that phase). I have had a lot of banging my head against the wall with coding. I can’t even begin count the number of times an errant semi-colon, colon, “end”, bracket, et cetera stumped me and I had to sit and review lines and lines of code to track it down. It’s all worth it though when it ties together and works just as you wanted. The thing that makes the persistence pay off is that you can see actual measurable progress appear right in front of you.

In Conclusion

When I learned piano everything was broken into elements so that you learned one piece at a time. First hand positioning, then sheet music, then basic melodies, then chords. Slowly as you worked through these individual elements they could be combined to create bigger blocks. All of this crescendoed into the moment when sheet music was placed in front of you and you could play a song you had never seen and didn’t think you could play.

I keep having these moments as I push forward coding where I look at the screen and say, “how did I know how to do that?”. The answer is pretty obvious after I add up all the time spent grinding away at it, but there’s still that sense of wonder when I create something out of thin air that I hope I never lose.

Leave a Reply

Your email address will not be published. Required fields are marked *