Today I had a very interesting conversation with my colleague Joel. We were discussing the very obvious advantages of some of the work we’d been doing using test driven design/development. In TDD, one writes unit tests first, and then codes to match the test. The result is more robust code, a test class that demonstrates how the code is to be used, and a unit test that accurately depicts what the requirements are.
Suffice it to say the conversation waxed philosophical, whereupon I mused on the following: test driven development is most like the scientific method. In the scientific method, one first creates a hypothesis (requirements), designs an experiment or experiments to test said hypothesis (unit test), performs the experiment, usually in a lab (write code), and finally, logs the conclusions of the experiments (view the results of the unit test – success or failure). Immediately, Joel seized upon this with a light in his eyes, declaring that in many ways, traditional development models are more like philosophy, whereas TDD is more like science. Traditional models require that you write a design document first – and then defend it in some sort of design review. Well, that’s more like what’s required for a Ph. D. as opposed to the TDD model which is structured more like a science experiment.
I might just have to write a paper. Quoth the Joel: “Using test driven design/development is more scientific.”