Archive for January, 2010

13
Jan
10

Calculator TDD Kata in JavaScript

So, I’m back from the deadosphere.

Here’s a run through  Roy Osherove’s Calculator Kata, in JavaScript, using Screw.Unit.

It was quite educational to do this kata and watch it back on video. The main things I learned were:

I am a horrible typist.

Writing code takes a lot longer than I think it does.

I expected to be able to do the beginner steps in about 10 minutes, but it actually took more than twice that long. Some of this is down to unfamiliarity with the editor (RubyMine), and some of it is standard programmer optimism.

It is embarrassing to watch yourself code….

I did this kata three times so I’ve watched myself code more than is healthy.

… but it is a great learning experience as well.

I see a lot of areas I can improve on, coding-wise, and there are some things I do a lot that I’ve never noticed before.

Without further ado…

Here it is. The first 21 minutes are the “beginner” steps, the following steps are about 15 minutes, and the remaining few minutes are code tidying. There is sporadic commentary for the bits that I feel are noteworthy.