TDD = A Design Exercise
Often the term Test Driven Development can be confusing to newbies who are new to the craft.
For people practicing TDD , this is a no brainer.
TDD helps one to create tests, watch it fail, and write code to make the tests pass and do it over and again. Since there is a test which needs to run for every line of production code, developers have to write code which is unit testable with a DI entry point for any external dependencies. This leads to code which is unit testable, more maintainable and less coupled. This approach automatically facilitates use of interfaces, composition over inheritance, cleaner classes in the domain model which follow SRP and related SOLID principles. Thus TDD leads to cleaner design, period!
Here is another blog post which drives the point home.
http://bradwilson.typepad.com/blog/2009/04/its-not-tdd-its-design-by-example.html
HTH,
Deepak.

Leave a Reply