Test-Driven Development (TDD): The First Leg of Emergent Design

Listen to this post

I am heartened by the surge in TDD training. To me, TDD is the second most important thing for devs to learn. ATDD is the first.

TDD is not just the automation of unit testing. It’s also intended to improve design and sustainability.

TDD’s formulation of tests, prior to code, drives design. High quality code is easy to test. The reverse is also true. Code that is easy to test is higher quality than code that isn’t. I labeled this quality, “testability,” in my book Design Patterns Explained. Test-First is a process where deciding on your tests before writing your code improves your design.

Automating the tests that result has low cost since frameworks can handle most of this work.

Sustainability of code has three aspects:

  1. Knowing what the code does later-provided by the test specs
  2. Having the code be relatively easy to change resulting from testability
  3. Having the code be safe to change-provided by the automated tests

There is one other aspect that is often ignored: the sustainability of the tests. This is equally important and not that difficult to achieve. But the tests themselves must be designed in the right manner.

To understand this, we must understand why patterns are so useful, which is my next technical post, Design Patterns: The second leg of emergent design.

Leave a Reply

Your email address will not be published. Required fields are marked *