TDD – Test Driven Dogma
When “doing TDD,” we consciously make design trade-offs to favor testability. Code that is easier to test can have all these other good properties: high cohesion, low coupling, clean responsibilities, and so on. But these trade-offs do not come without a cost, and I think it’s important to keep that cost in mind.
For example, consider all the recent concern over interfaces – to summarize – we end up with a lot of single-implementation interfaces because of testability concerns and from weaknesses with our tools. This comes at a cost of additional API complexity and friction for the developers trying to work with the code. (This friction can be reduced by good tools like ReSharper, but it’s still friction.)
So, choose to make this design decision because you think that the benefits the decision are worth the cost – but do not make decisions based on blind groupthink, and certainly understand that there IS a cost involved. To do otherwise is to risk falling into a trap of proselytizing the One True Path of Development, while forgetting the ACM-sanctified answer to all software architecture questions: “It depends.”






Here, here.
I would add the the equation: what is the cost of NOT doing something.
(I’m assuming some of this is coming from my interfaces post: http://elegantcode.com/2008/09/11/are-net-interfaces-required/)
The smaller the project, and the less complex, the less you see a benefit from various techniques.
I was reading Domain Driven Design (DDD) by Eric Evans a while back. He does NOT recommend you use DDD for every project. For some applications, a smart client approach (direct databinding to a form) will provide the same results much faster. But on larger, more complex applications, a DDD approach is very valid. I’ve even seen these two approaches used in the same application from time to time.
But where EVERYONE has issues is what do do when applications grow. Not all applications do this, but enough do to cause issues. If you created the project using a smart client approach, you can end up with a lot more work to incorporate new features. If you take the full TDD approach, you might have done a lot of work for nothing.
Trade-offs continue.
@chris: “what is the cost of NOT doing something.”
Exactly my point. Always consider your approach.
3mx9drf94vasrbrg