It’s been a while since I last learned a language I was going to use full-time at work, and usually that means hard work to master the thing; the drawback of being considered a senior is that people expect you to be an expert at everything, so you need to work really hard in order to not disappoint them ;-). Really studying a language (not like Seven Languages in Seven Weeks) made me think about how we’re learning in our profession versus other areas of skill I happen to know a bit about, like performing classical music.

My parents sent me to music school around the same time I started elementary school, so reading sheet music and reading written words are probably just as natural to me. After a few years of the basics, I got sent to a piano teacher to learn a proper instrument (until then, it was recorder which is a beautiful instrument but not in the hands of a six year old). The next decade-and-a-bit, after some initial crises over not wanting to learn playing the darn thing, I got to like it and got proficient basically by working real hard. Later on, I repeated that by getting training in trombone and (classical) singing; to my surprise, it was way easier to learn trombone as a thirty-something year old than learning piano as a six year old. I guess experience does count.

Looking back, if I contrast learning a musical instrument with learning a new language, especially in a work environment, there are some differences that stand out.

Most importantly, when you are a performer, your study-to-performing ratio is probably close to ten hours of practice to each hour of performance. If you are a computer programmer, it is probably one to a hundred, if you’re lucky. No wonder that the guy sitting in front of the orchestra behind a concert grand piano can do these awesome feats - he had oodles of time to prepare for the event. I’ve never been much of an athlete, but the same holds there: when I was training for the university’s varsity rowing team, half a year of exercise prepared for a couple of months of racing (I wasn’t selected, by the way, but still got very fit :-)). We just get Programming Ruby dropped on our desk and are expected to be coding important stuff a week later.

I think it’d be a bit rich to go to our respective employers and ask them for 3 months of training time for every week of coding on projects, or something similar, but it does show that “practice makes perfect” holds true and you want to get as much of it as you can.

Of course, I’m hardly the first one to make that observation. By now, the practice of code katas is quite common, but every time I go through them, it felt like something was lacking. Then I started working on a hobby project, Uderzo, which made things fall in place. Bear with me on a little detour through music again.

When learning an instrument, there are three levels of practice which I think are each important in their own right:

  • Scales allow you to warm up, in analog instruments like trombone tune your ear and muscles to hit the right tone, and basically help you in complicated pieces by help train muscle memory to commonly occurring sequences of notes.
  • Études are basically scales on steroids. They are musical pieces that purely exist to practice certain techniques on a larger scale than just scales. Chords, sequences, complicated musical transformations, most of the stuff you will encounter in a performance piece will be there. Some people are so gifted that their study pieces become performance pieces, Chopin probably being the best known example in the piano world.
  • Performance pieces are the big sonatas, concertos, and what not that makes an audience come and attend and maybe even pay. These are, in a way, the actual thing you want to do because that’s what brings home the bacon.

I was a lazy student, so I focused as much as possible on the last and as little as possible on the first two until I got older and got to appreciate the value of practice. When I look at our craft, I see a missing link: code katas, to me, are like scales - very low level exercises that help you train muscle memory, learn the libraries of your languages, and makes you think a bit about small-scale algorithms now and then.

But that’s hardly the most important part of programming. The trickiest bit is to construct (design, architect, pick a word) whole applications, not to write an implementation of Bloom filters. Where are our études?

I think that you need your own (open source) projects for that. Build a whole system: it needs to have persistence, a user interface, business logic and algorithms, and should be scratching your own itch so you don’t get bored and give up after two nights. Not just an algorithm or library routine, but a whole system. Including the parts you don’t like. Designing systems in new languages is where the rubber meets the road and I think that doing this a couple of times is mandatory practice before you start to work on that nuclear power plant control system your boss tasked you with. Implement a blogging system, a Pong clone, some IoT device. Don’t stop at katas, you’ll be missing out on the stuff that really matters in a programming language: how to fit all the bits and pieces together into a coherent and maintainable whole, what the right and the wrong libraries are, how to find and optimize the performance bottlenecks, et cetera. That is the sort of practice that makes perfect.

Then, you can go to your boss and ask to be able to study for your “concert piece” three times by doing the project twice, tossing it away, and then going for the final performance. If only… I guess the analogy has to break down somewhere ;-)