| It's fairly straightforward: TDD is red/green/refactor, which means you're working in very small steps (about a minute or two each) and thinking about design during two out of three of those steps. During "red", you're thinking about the design of your public interface. During "green," you're focusing on implementation. During "refactor," you're thinking about how to improve the quality of your implementation and how to improve the overall design, and making those changes. If you believe that spending a lot of time thinking about and improving your design will produce a high-quality design, then TDD will produce a high-quality design. QED. If you don't accept the axiom, then it's a longer discussion, but that's the proof, and my experience is that it does in fact work. (If you're looking for a rigorous study and proof, you won't find it, because there are no rigorous studies that formally prove what creates high-quality design. Partially because there is no formal definition of "high-quality design" in the first place.) |
"Refactor" is named this way to emphasize that changes you are making are closely related to the tests you already have and the tests you are about to introduce.
That does not leave enough space to justify a QED. If you choose to design beyond that, the process stops being TDD - at least as described by Kent Beck