There is another subtle benefit at work in the philosophy of agility. When developers are forced to think through how the code will be tested, or better, when developers realize that they themselves will have primary responsibility to assure that it passes the test, a new psychology emerges: developers write the code differently than they otherwise would have. In other words, the developers build systems that are inherently testable by building in the interfaces and methods they need to see inside their components to assure they work as prescribed. This is one of the key benefits of agile methods, and these inherently testable systems exhibit higher overall quality.
Lately I have been feeling like every time we write tests before we write the code we end up writing higher quality code. I have no real way to prove that through logic though. It just seems like having to write the test forces you to decouple your code and simplify your interfaces. This process of decoupling and simplifying gets your mind working and you end up writing better code.
Maybe we should start calling it DTT (Design Through Tests) instead of TDD. People might be more willing to give it a shot if they thought they were focusing on design instead of focusing on tests.
No comments:
Post a Comment