Alex Rivera | Logout

Does Test Driven Development take the focus from Design?

Asked 2008-09-17T05:20:05.297
23

I have mixed feelings about TDD. While I believe in testing I have a issues with the idea of the test driving my development effort.

When you code to satisfy some tests written for an interface for requirements you have right now, you might shift your focus from building maintainable code, from clean design and from sound architecture.

I have a problem with driven not with testing. Any thoughts?

Edit
Report

1 Answer

1

For the most part I agree that TDD does provide a sort of design tool. The most important part of that to me is the way that it builds in the ability to make more changes (you know, when you have that flash of insight moment where you can add functionality by deleting code) with greatly reduced risk.

That said, some of the more algorithmic work I've contracted on lately has suffered a bit under TDD without a careful balance of design thought. The statement above about safer refactoring was still a great benefit, but for some algorithms TDD is (although still useful) not sufficient to get you to an ideal solution. Take sorting as a simple example. TDD could easily lead you to a suboptimal (N^2) algorithm (and scads of passing tests that allow you to refactor to a quick sort) like a bubble sort. TDD is a tool, a very good tool, but like many things needs to be used appropriately for the context of the problem being solved.

answered 2008-09-17T06:27:05.480

Your Answer