This morning I did my first Kata, and I must say it was a really enjoyable experience. So, what is a Kata you might ask. A Kata, in the traditional sense, is a Japanese concept describing detailed choreographed patterns of movements practised either solo or in pairs1. In software development it is exactly that, you follow a predefined set of steps in order to solve a particular problem.
The intention is that by doing the Kata multiple times the good habit, that the Kata is describing, will be formed and becomes natural in your normal working situation. I did Uncle Bob’s Prime Factors Kata2, based on the recommendation of a colleague. And I will definitely be doing it a number of times over the next few months to enforce the TDD approach it is describing.
I have been doing “TDD” for a while now, but it is not truly TDD. I find proper TDD hard because you are required to write a failing test for a piece of code you don’t know yet. So I generally write a bit of the code, and then only start writing tests. I think I find it hard to do TDD, when writing new code, because of all the years of simply writing code, without tests, and the bad habits that have formed as a result.
I also like the it because the Kata takes what it is trying to convey beyond books. I have done plenty of reading around TDD and know all the theory, but the I have found the implementation harder than it looks when reading books and articles.
So by doing this Kata, and others, I hope to rewire my brain to undo any bad habits I have formed over the years and to start forming new habits that are more efficient and desirable when writing code.
This is definitely something that can be done whenever you have a quiet moment and are looking for some coding to do.
- Kata – available at http://en.wikipedia.org/wiki/Kata
- Prime factors Kata – available at http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata