Most of the time when something comes across my aggregator that I disagree with, I just let it slide and ignore it. There’s really no point to arguing about philosophical differences with other bloggers because both sides think they’re right. But occasionally differences of opinion are actually nothing more than miscommunication; misunderstanding. Many times two people are on the same side, they just don’t know it. It is at these moments that I see opportunity; a chance to bring two seemingly opposites sides to the realization that they’re actually on the same side. They just don’t know it yet.
For instance, take Paulo Morgado. He posed a question yesterday, asking whether TDD is a good or bad thing. Then he says it’s bad. On the surface, I completely disagree with him. But if you look closer at his post you might find it’s simply a case of misunderstanding. And I think this is pretty common when it comes to TDD. Test Driven Development is new, and like all things new and shiny people are going to be skeptical or make snap judgements. They’re going to form opinions quickly. Hey, that’s what we do – we’re human.
Paul writes:
…my beef is with the Test Driven part (or Example Driven Development (EDD) if you like other flavors). Came on, is your software really being driven by the tests? Are you really writing software just to satisfy your tests? I’m not.
Just to satisfy tests? No. We’re writing software to satisfy customers. But in the process, we take their requirements and turn them into tests. So in a technical sense, yes, we are writing software to satisfy tests. And the tests are definately driving our design.
Think about what design really is. It’s making decisions. In software, like other disciplines in life that require you to make decisions, there’s more than one way to solve a problem. There’s more than one way to skin a cat. The decisions we make are often determined by a lot of factors; there’s a lof of elements to influence which way we’ll go and how we’ll proceed. But unless those factors eliminate every possible solution from our vision save one, we still have to make a decision. This is the process of design.
TDD is just another factor in our decision making process. It doesn’t drive the whole design – it can’t. Humans are the final decision makers, and we ultimately control the wheel. But TDD helps lead us down one path among many paths. It points us in a good direction. It drives us down a particular road.
Paul continues:
Test driven development also makes you design for testability instead of designing for funcionality, scalability and other such much nicer things.
This is simply incorrect, and I’m sure any number of TDD practioners will back me up on this. Testability is not mutually exclusive to functionality, scalability or other important software aspects like performance. In fact, quite the opposite. TDD helps make sure such things are done properly with automated tests to ensure correctness. By writing the tests first, and then writing the code to make the tests pass, we ensure that the requirements are met. And those requirements can be anything, from functionality to performance.
More Paul:
My software development is driven by the need to comply with requirements.
Everyone’s software is driven by the need to comply with requirements.
Test Driven Development helps us, as developers, steer the solution toward a particular path. In a sea of solutions, we can choose many. TDD helps us focus on a particular subset of solutions. In return we get many benefits. We have automated regression tests to aid us during code changes. We get the confidence that comes with tests, knowing that our software works the way it is supposed to. TDD helps us design for simplicity, decoupling and aids us in building code that is easy to refactor, change, and maintain. You get a lot of bang for your buck when you invest in TDD. It’s so much more than just writing code to satisfy tests.
Paul finishes by writing:
My software development is driven by the need to comply with requirements. How am I doing it? Assisted by tests. So, I’m doing Test Assisted Development (TAD).
Which brings me back to my original point: many of the differences people have are often nothing more than misunderstanding or miscommunication. Test Assisted Development? Is that really any different than Test Driven Development? I suppose if you never allow a unit testing scenario to guide or influence a design decision, then maybe they are different. But that seems like a very difficult thing to do, because if you’re writing test-first then the very act of writing code to make the test pass is going to influence your design (decision-making) process. And what’s the difference between “driving” the design and “assisting” the design?
I’d say: nothing.
In the end, we’re all after the same thing: we want to build the best software we can.