January 13, 2012
TDD Is Neither Necessary Nor Sufficient For Good DesignDan North (@tastapod on That Twitter) rightly points out that TDD is neither necessary or sufficient for good software design.
I make no bones about it. TDD is not the only way to achieve high quality, reliable, maintainable code.
He tweets "Some of the worst code in the worst codebases I've ever seen was 'strictly TDD'."
Flip it over, for balance, and I can also honestly claim that some of the most horrendous code I've ever seen was not test-driven. Based on admittedly small-scale studies, TDD'd code tends to be simpler. But good design is about a lot more than that.
Which is why my TDD course focuses on these aspects of the discipline - the simplicity, the refactoring (LOTS of refactoring!), readability, minimising duplication, localising dependencies ("Tell, Don't Ask"). These basics should be core to any TDD text or course. If more programmers paid attention to just those basics - simplicity, readability, duplication and localising dependencies (darn it, if they just put more effort into readability!), the software world would probably be a better place.
But I also make it clear that those basics will only get you so far, which is why I have 3 other courses that all - from one angle or another - focus on software design. All of my courses are really design courses.
In the refactoring course, we learn about common code smells and how to safely eliminate them. In the OO Design course, we learn about SOLID and other dependency management principles, as well as how to more objectively identify dependency issues, and then refactor the code to address them.
In the Agile design course, teams use a bit of collaborative up-front to establish a shared understanding of the basic architecture and co-ordinate their efforts to flesh out and implement different features of the same software. When they implement it, they test-drive it, and continuously integrate, and refactor and etc etc.
It all dovetails nicely together to hopefully present a more rounded picture of software design in an Extreme programming sort of approach. But altogether they are still not sufficient.
There's a knack to good software design, and a whole heap of other stuff you need to know. I've been a student of software design for decades, and I'm just getting started.
So Dan's quite right. You need more than TDD, and there are other ways of achieving good design.
Posted 7 years, 3 months ago on January 13, 2012