I’ve been hearing about Katas and Coding Dojo’s for a while now, in fact probably since I first ran across the Alt.Net movement and it’s gained momentum with the Software Craftsmanship crowd.  In fact, lately I seem to be hearing about them more and more, so much so in fact that I’m starting to think of it as the latest fad in software development and the newest bright and shiny thing for all us alpha geeks to get into.

Every time I thought I should look into it all that Japanese sensei kung fu metaphor stuff keeps getting in the way.  It comes across as being a wee bit pretentious and self congratulatory (you may insert your own more vulgar terms here if you so please) for me and so I kept ignoring it and hoping it would go away, but the ground swell of noise about it is growing and becoming harder for me to ignore.

So yesterday, prompted by yet another post about Katas by Robert Martin and a discussion at the Sydney Alt.Net group meeting, I decided to get off my high horse and see if there’s something of value to it.

First I watched the video of Uncle Bob doing the Prime Factors kata in Ruby.  It took him less than 10 minutes to get it done, following TDD and “simplest thing that works” practices.  After watching that I said to myself “self, you should be able to do that in C# on the way home on the train.  How hard can it be?”.

What an eye opening and self humiliating exercise that was :-P.  A half hour train trip and I didn’t get to done! I took me another 5 minutes after I got home to get it all finished.  Geez.  Embarrassing or what!?

I sat back after I finished and thought about what I did and where the slow points were.

imageFirst up I had mucked around with making a test project in studio and creating a solution when actually I could’ve just put tests in the same project as the code itself (it’s throwaway code after all).  I also don’t need to save a full solution file to disk so I had spent a little time turning off the Visual Studio option to automatically save  projects on creation (see image).  I won’t need to waste this time again next time around.

I also decided to use xUnit instead of my more familiar NUnit/MSTest environments, because I want to get better at xUnit and that’s the point of practice, but it took me a little while to get used to using [Fact] and [Theory] instead of [Test].

Finally I realised that I was still doing way more mousing around than was necessary.  Mouse means SLOW, and even with my trusty ReSharper installed I’m still not taking enough advantage of it, or learning all the keystrokes.

The end result being that while I was slow at it doing the Kata proved to me it’s value.  That I should practice doing the right thing when implementing a well known problem so that I get better and faster at doing it.  That way when I have to do real development work then I’ll have those improved skills at hand and will use them to get the real world development done better and faster .

So, yes, Katas may well be the next shiny new developer toy, and yes the whole Japanese code-fu warrior thing is silly and corny, but the value of practicing to improve my skills is definitely there.  Now all I need to do is to be disciplined and do katas on a regular basis.  As a goal I want to be able to do these Prime Factors kata in about the same time a ruby the ruby one took.  Wishful thinking? Maybe, But I can definitely improve on my first up effort, that’s for certain.

And the challenge for you?  Watch the video and try the Prime Factors kata yourself.  How long did you take, and could you do it faster the next time around?