|
6:17:54 AM |
 |
Coding in the Small. Test Driven Development: By Example by Kent Beck has changed my life in 48 hours. While I haven't completely gone test-first, I have radically changed the way I write code. Specifically, I'm using a lot more fine-grained interface-based designs in order to make testing with mock objects easier. My test-cases now actually demonstrate the logic instead of just blindly exercising methods after a bazillion lines of setup code. TDD has forced me to think about coding in the small so that I focus on exactly and only the portion I'm currenlty working on. Over the past 3 days, I've noticed... [bob mcwhirter]
Even Bob's catching the fever.
In my programming career I have had three major advances that have totally changed (for the better) the way I think about development.
-
Getting my head around programming. Suddenly anything's possible.
-
Getting my head around OO. Suddenly everything's cleaner.
-
Getting my head around TDD. Suddenly everything has meaning.
For me, TDD is a specification, design and documentation tool. From writing a test alone you can specify what you want, derive an intuitive interface and end up with a snippet of code as an example of how to use it. With this specification in place you also have a goal, the green bar - your tools will tell you when you're done. And it's hard to practise TDD without components that are all munged together, so loose coupling tends to appear. The fact that you get unit-tests for free is also a nice bonus which allows daring refactoring.
|