Posts Tagged ‘programming’

Programming Etudes

December 6th, 2010 3 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!!

Buffalo buffalo buffalo buffalo …

January 16th, 2009 No comments

Today I had a programming experience akin to the grammatically correct sentence “Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.”

I’m working on a DSL that has values, which probably should have been called elements instead. I say this because I had to add a value keyword to the language which, of course, entailed a class named ValueValue. See where this is going? I knew things had gotten out of hand when I wrote this line of code:

    ValueValue valueValue = (ValueValue) value;

Yipes. Maybe this is why some think naming constructs is the hardest thing about programming.