Home > software engineering > Programming Etudes

Programming Etudes

December 6th, 2010 Leave a comment Go to comments

Can you implement a stack off the top of your head? How about a simple hash table? A recursive descent parser? Can you do it without thinking about it?

These are a few programming “etudes“. Musicians have a tradition of etudes designed to teach fundamental lessons about playing their instrument. They practice them (usually as children) until they can play them perfectly from memory. Just like with the programming examples above, a musician doesn’t play these etudes in “the real world”. They’re technical exercises so that when they get on stage they can make an artistic statement rather than worrying about fingerings.

A pianist practicing an etude may focus on alternate fingerings, dynamics, tempo. What are equivalent variations you could try while doing a matrix multiplication “etude”? Elegance? Performance? Generality? Obfuscation?

Build your own set of programming etudes. Practice them. They’ll make you a better programmer. Now repeat in another language.

Can you minimize key strokes in your editor? Try it in a different editor?

Can you design a series of etudes that build on each other? Maybe it’s like programming a fugue? Linked-lists + a hash function becomes a hash table. What’s next?

Can you think of etudes in your favorite framework? The “fifteen minute blog” is one. See, it doesn’t have to be all about data structures and algorithms and clever interview questions. It’s about getting the tools of your trade under your skin.

What else?

Now go read Dave Thomas’ CodeKata.

Practice, practice, practice!!

  1. Jack
    December 7th, 2010 at 13:35 | #1

    Excellent share and good ideas, gives me something new to roll into my weekly routine. Thanks

  2. December 7th, 2010 at 13:47 | #2

    Thanks Jack!

  3. January 13th, 2011 at 07:56 | #3

    It’s not true that musician don’t perform ├ętudes. As noted in the Wikipedia article, those of Chopin and Liszt, for example, are established concert repertoire. Public performance affords the pianist a chance to display his or her technique, as well as ability to render these exercises artfully and “musically.” For the composer, the ├ętude is a pedagogic form for expressing an elegant solution to a technical problem.

    Both composition and performance have analogies in programming. Formulating a programming problem or puzzle is a way to demonstrate a grasp of the issues, while publishing/sharing solutions gives programmers a chance to develop and show mastery of their craft.

  1. No trackbacks yet.