The Elastic Leadership Book

 

 

        RSS Feed

Latest Entries

Thursday
Oct012009

How to measure programmer productivity using TDD Katas

A TDD Kata is an exercise in writing code, test first, which one repeats once or more a day. Here's an example of one.

I make students that take my TDD course do this kata each morning, in the space of 30 minutes.

Near the end of the course, they become more and more skilled with the tools and can actually get to finish it in 30 minutes, and they get faster and faster.

The point about the Kata is that you should know it by heart. you should not be thinking about the solution, your fingers should by typing it "blind", including all the refactoring work, the renaming and whatever else you do.

A Kata is about muscle memory - so that we feel comfortable doing that something in the real work, without needing to think about it.

If you know it well enough, you can start timing how long it takes you to finish it. THe faster you finish it (with same results, clean code and working implementation) the more it means you are productive.

Why?

Because at some point, the only things that take the time in the kata are those darn keyboard keys and mouse! The more shortcuts, snippets and key combinations you learn to get your job done, the more you have minimized those things in your developement writing that take the time.

So a kata is about muscle memory, but  you can use it to measure how well you are mastering your tools, or how productive you are as a programmer.

what's fascinating, is that if you look hard enough you'll find that there's always something that can be done even faster eithout hurting the end consequances. here are some examples:

  1. No need to type that whole Setup method with attributes on the code. Create and use a live code snippet to generate it in a click or a key press.
  2. No need to select a whole line before removing it - learn to use shortcut keys to do that in one action.
  3. No need to manually go to a code finle when you can navigate to the last edit location in a blink of an eye with your tools

and there are a million more.

it's about mastering your craft. and now there's a way to measure it.

« A simple way to know you're missing some leadership skills | Main | Leading Through Learning: The Responsibilities of a Team Leader »

References (2)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (4)

I think there is value in mastering tools but I object to the idea that you can derive a measurement of 'productivity' in the manner you've described. A product such as Resharper will indeed contribute to my overall productivity, but surely you would agree there is much more to programming than typing! More often than not my productivity is determined by how fast I can comprehend, decompose and create useful abstractions.

October 1, 2009 | Unregistered CommenterPaul Batum

Thanks for sharing this. I've been looking for a simple way to help people learn TDD and this sounds like a great idea.

October 1, 2009 | Unregistered CommenterMichael Hedgpeth

I like the code kata very much but I agree with Paul that we often equate efficiency in actually typing the code with being a better developer. Obviously knowing shortcuts in generating the actual code will help you get the work out faster, but that does not directly infer quality. Anyone can type crap code very quickly. I am a horrible typist and even worse at remembering keyboard shortcuts. I have to admit that the actual chore of entering the code takes longer than the average bear for me personally. But I like to think that I capitalize on that time by reflecting over what I am typing and if it fits the needs of the moment while adhering to the coding principles I value. I am trying to do more code kata that forces me to use some of the shortcuts I have a hard time with so I can get better at using them, but I am afraid I will probably never get as fast as some of the people I have watched that have superior typing skills and an intimate knowledge of keyboard shortcuts and IDE tricks. Maybe I will pair with those types of people more so it will rub off faster! Thanks for the post.

October 1, 2009 | Unregistered CommenterTommy Norman

Thanks a lot Roy. This has got to be the best way to get up and running with unit testing. Maybe you can go ahead and write the 'dive into TDD' book :). Btw, I cant wait to see more advanced KATAs. Again, thanks.

October 4, 2009 | Unregistered CommenterZaki

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>