Measure First - Cut Second

I’m here in the trenches fighting for Test Driven Development (TDD), while Rjae is providing us with insight into up and coming technologies. A contradiction? Percs is not the place for discussing issues at the ground level of technical innovation?

We don’t think so! After all, if web services will be our future for defining a contract both metaphorically and soon probably legally speaking, we need a better way to both enforce and verify its implementation and fulfillment.

So start with an interface definition, which can be a wsdl, business spec, interface, or whatever else you have (even a verbal from your client will do) and write a test. Make the test work and then write your implementation, and you will be able to sleep at night while your service services clients in an 24x7 global environment.

Where I divert from the mother school of XP, is that design is a continuous process without front end effort. I do believe in its continuity, but I also think that application domain design down to the class interfaces is essential for defining meaningful tests.

It still requires a lot of convincing on the both the developers and management side:

Developer: “Well, you’re telling me that if my class has a method that takes 10 parameters I need to write tests for all 10! permutations?”

Most likely you will discover in the process of developing the tests that you’ll need to go back to the interface design/spec to see whether 10 parameters will be required and the layout of your interface is correct and simple. Besides, wouldn’t you have to test the same permutations manually before anyway, or are you not doing unit tests???

Manager: “But I need this piece of functionality by next week, we don’t have time to test it. Otherwise, I won’t meet my numbers and won’t get my bonus. I don’t care what comes afterwards.”

“Well, we’ll have a better chance of meeting an insane deadline, if we don’t have to do things over 5 times, so wouldn’t it help to test first?

I’m sure this is not the last time we’ll be covering TDD here, but I’m convinced that whatever we’ll be building 5 years from now, it will have enforceable and automated SLAs attached and no SLAs without Tests!