What is the #1 Benefit of TDD?
The Agile Zone is brought to you in partnership with Hewlett Packard Enterprise. Discover how HP Agile enterprise solutions can help you achieve high predictability and quality in your development processes by knowing the status of your projects at any point in time.
My answer: It makes you think before you write code.
In fact, next time somebody asks you what TDD stands for, you answer:
Sure, all the benefits are there: structured incremental progress, good coverage, and confidence when refactoring.
But over and over again, when I see people starting to think about their first test, it comes back to me: It’s the think-before-you-act thing.
In that session, we did the kata for counting code lines (3 times with 3 different groups). And three times, almost at the beginning, questions came up:
- What constitutes a line?
- In what language are we writing?
- Do we count blank lines?
- does an “if” block counts as one line, even if it spreads over four lines?
- Does a line need to contain compiling code?
And so on. All of these questions came up before the first test (empty string, zero lines) or immediately after it. This kind of thinking and discussion before writing the code is what makes quality code.
So repeat after me: TDD is Thinking-driven development.
See how it rolls off the tongue?
PS: You can read a recap in Hebrew about how awesome I…, I mean, the meeting, was).