September 1, 2010

...Learn TDD with Codemanship

Session Inspirations for SC2010

I've had emails from folk who are coming to Software Craftsmanship 2010, and would love to lead a session, but are a bit stuck for ideas.
It's easy, really, though. Do what I do. Take an existing kata (or "etude", as I prefer to call them 'cause I'm a musical, peace-loving kind of guy) and add a twist.

For example, how about running the Roman Numerals kata (yawn), but forbid people to use the mouse/touchpad (hoorah!)? Or FizzBuzz, but the rules are that you can't have more than one line of code in any method? Or how about a bit of deliberate anti-craftsmanship? How many code smells can you cram into 100 LOC? What's the most complex implementation of "Hello, world!" you can conjure up in 30 minutes? We can learn a lot about doing it better by trying to do it worse.

A boring old exercise can become an interesting challenge with a couple of extra rules. Like swimming lengths, but this time you gotta do it in your pyjamas.

Or how about working off a Bletchley Park theme. The logic of an Enigma machine fits into about 50 lines of code, which is just right for a 60-90 minute TDD workout. Just Google "enigma machine" + your favourite programming language and you'll be surprised how many examples there are. You could run a spy school and have pairs compete to send each other messages with their Enigma simulators.

Practice is not just about mastery through repetition. We need to stretch ourselves, and spicing up old katas is a great way to add variety and to make us work those codecrafting muscles.



Posted 7 years, 8 months ago on September 1, 2010