Code Kata: Scales for development

May 15, 2011 - 2 minute read -

Anyone who has ever learnt a musical instrument will tell you of the pain of learning scales and arpeggios. Those that stuck with their instrument will tell you that these are the constructs around which all music is based, defining which notes sound right or good within a given key. The most common keys in classical music are grouped into major (“happy”) and minor (“sad”); other musical forms have other scales, such as modes and blues.

But this is a software development blog, not a music blog. Why am I talking about musical scales? Well, you may not be surprised to read that the idea of practising the equivalent of scales applies to any skill you might want to learn. For writing, it’s practising writing little pieces of text: blog posts, Stack Exchange questions and answers, etc. For music, it’s scales and arpeggios. For software development, code kata.

Code kata are little exercises to be practised over and over. They encapsulate a simple problem (“simple” as in “well-defined”, not as in “easy”) such as scoring a game of ten-pin bowling, or calculating prime factors. The exercises require you to design and implement a solution to the presented problem, and are a great way of learning a new technique (they lend themselves excellently to TDD, for example), or a new language.

I’m making a start with The Pragmatic Programmers’ kata over at http://www.codekata.com. Others are available from http://katas.softwarecraftsmanship.org and http://programmingpraxis.com. I’ll be blogging my progress here; if you’re doing kata too, let me know how you’re getting on.