Pages

Friday, March 21, 2014

My TDD Happiness Graph

I'm helping my friend Mayur with TDD and he has his frustrating moments as is evident from his tweet

This happened with me when I was learning TDD. This happens with everyone. Key is not getting demoralised and keep going. I did not know this in the beginning and I gave up. Then came back again. I wanted to share this experience in best way possible and I came up with follwing - My TDD Happiness Graph

Take a moment and look at the graph. There are few interesting things in there

  1. It takes time to master the art of TDD (I am no way close to mastering the art yet). 
  2. In the beginning you would have lot of "turn off" moments with TDD. More experienced you are, more "turn off" you would have
  3. The real kick start to my TDD learning was when I paired with someone who knew how to test drive my code
  4. For long time, I was only test driving my C# code, leaving my JavaScript to mercy of time. It took me a while to realise that JavaScript can be tested with same effectiveness as any code in statically typed language. The tooling support for testing JavaScript code is not spectacular but it is not disappointing as well
  5. I have indicated that my happiness took a dip with dependency injection (DI). That may be misleading and hence clarification. TDD makes it easy to inject dependencies and mock them during tests. This made life so easy that I made mistake of applying DI without giving consideration SOLID and code maintenance. Overtime I learned how to tame DI but it is worth mentioning mistakes I made
  6. In the end, I have shown as having reached "TDD heaven". I do not know what this means, it just something came to my mind. This is a state where every time you code or think about code, you start with tests. Things like SOLID automatically follow or at least TDD makes it easy to refactor your code (brutally if needed) in order to achieve SOLID. 
One last thing, this is my experience with TDD and your experience may be different. But I am sure you had your own happiness crests and troughs in the journey.

I was finding it difficult to make Visio and blogger work nicely with each other but I failed. If you are seeing the image blurred then a high resolution version is available here

TDD Happiness Graph


No comments:

Post a Comment