Andy Mehalick

TDD Code Kata

The virtues of code katas were first extolled to me at a TechEd conference several years ago but despite their apparent value I could never seem to commit myself to try them. Recently though I decided I wanted to master refactoring with ReSharper and found a perfect excuse to kick-off a month-long code kata regimen. Having taken a deep dive into TDD with Roy Osherove’s TekPub video series followed by his book The Art of Unit Testing I was aware of this string calculator TDD kata and knew that’s where I wanted to start.

Working remotely in a +8 hour time zone made it easy to tack an extra 30 minutes onto my work day and commit to waking up my fingers and brain with a daily code kata first thing in the morning. I decided to keep a log of my progress and note any shortcuts or approaches I learned along the way. I wanted to not only exercise my TDD skills but also my efficiency with Visual Studio and ReSharper.

On day one I started the exercise mouseless and that meant a small learning curve; adjusting was easy enough though. To pile on the pain I also decided engage my katas using only a proper touch typing technique. My natural typing style is more akin to a predator drone, hovering and attacking with calculated fury. Yes, most of my fingers get in on the action but collateral damage is high and it is far from touch typing. Actually typing correctly may have been the hardest part of this challenge. 

The following screencast is my recording of the final kata on day 20 with my TDD and ReSharper commentary.

Screencast

Daily Log

Day Progress Learned
0

I didn’t count this as an official day, I just spent time learning keyboard shortcuts and how to navigate Visual Studio without a mouse. I learned the existing keyboard shortcuts:

Ctrl-Shift-N – New Project
Ctrl-R, V – ReSharper’s Introduce Variable

… and created some new ones:

Ctrl-P, Ctrl-M – Open Package Manager Console
Ctrl-R, Ctrl-T – Run TestDriven.NET Tests
Ctrl-R, Ctrl-A – Run Tests Again

1 Steps 1 – 3
2 Steps 1 – 3
3 Steps 1 – 3 and started 4 Alt-\ – ReSharper’s Navigate Members
4 Steps 1 – 3 and started 4 Ctrl-R, P – ReSharper’s Introduce Parameter
5 Steps 1 – 4  Ctrl-R, V – ReSharper’s Introduce Variable
6 Steps 1 – 4 and started 5 Created NUnit PowerShell cmdlet for Install-Package NUnit; started using NCrunch for continuous testing.
7 Steps 1 – 4 and started 5
8 Steps 1 – 5 FINISHED! Gave up on NCrunch, just not for me.
9 Steps 1 – 5 Finished
10 Steps 1 – 5 Finished
11 Steps 1 – 5 Finished
12 Steps 1 – 5 Finished
13 Steps 1 – 5 Finished
14 Steps 1 – 5 Finished
15 Steps 1 – 5 Finished
16 Steps 1 – 5 Finished
17 Steps 1 – 5 Finished
18 Steps 1 – 5 Finished
19 Steps 1 – 5 Finished
20 Steps 1 – 5 Finished