The Primary Benefit of TDD
With plain ol’ after-the-fact unit testing, the obvious, most significant benefit you gain is increased confidence that the code you wrote works as expected—at least to the coverage that your unit tests provide. With TDD, you gain that same benefit and many more.
Systems degrade primarily because we don’t strive often or hard enough to keep the code clean. We’re good at quickly adding code into our systems, but on the first pass, it’s more often not-so-great code than good code. We don’t spend a lot of effort cleaning up that initially costly code for many reasons. Joe chimes in with his list:
-
“We need to move on to the next task. We don’t have time to gild the code.”
-
“I think the code reads just fine the way it is. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access