Monday, 19 July 2010

TDD Masterclass with Jason Gorman. Day 1.

I wrote this on the way home from the Masterclass, posted a few days later though.

So I'm on my way home from the first day of a TDD Masterclass with Jason Gorman. Some of you will recognize the name from Code Smell Of The Week.

I had a good day.

I haven't been keeping up with my studies as much as I'd like to and don't get to code as much as I'd like to so I thought I would struggle.

I didn't struggle as much as I thought I would and in fact the biggest struggle I had was when I was paired with a non Java Developer. I don't mean that as any disrespect to him but he was late to the classes (later than I was) and hadn't yet made the mental switch from his usual language to Java. And I only know (a bit) of Java. I followed his lead and so managed to confuse us both, I should have taken the lead until he settled in and then followed his lead (as the experienced coder).

When I was paired up with Java Devs or Devs that knew Java and had a bit of guidance I was fine.

We went through a couple of coding exercises and essentially covered TDD basics. A couple of which I'll list here:

  • Resist the urge to refactor your tests, wait until they've passed.
  • Test one thing at a time.
  • Keep your tests individual.

Resist the urge to refactor your tests until they have passed or you run the chance of going off in a tangent and paying too much attention to the tests.

Keep your tests simple, test one thing at a time or your tests will get more and more complex and you may start trying to test rather than doing TDD.

Keep your tests individual, you are testing one thing at a time, if your test relays on another test you run the risk of a tests failing for the wrong reasons.

In order to use TDD you need to discipline yourself and follow the basics until they are second nature. I thought that while I'm working on my coding I may as well start using the basics so that when I've got my coding to a level I'm happy with I'll have already been practicing TDD.

I'm glad I took the course and would recommend it to proficient and beginner coders alike.

Tomorrow, onto Mocks!

No comments:

Post a Comment