Over a million developers have joined DZone.
Platinum Partner

What is the #1 Benefit of TDD?

· Agile Zone

The Agile Zone is brought to you in partnership with JetBrains.  Discover how to increase change awareness, code quality, and maintainability through straightforward code reviews, with a simple, lightweight workflow.

tddI was asked this question when I led a TDD open session at the Israeli Software Craftsmanship User Group.

My answer: It makes you think before you write code.

In fact, next time somebody asks you what TDD stands for, you answer:

Thinking-Driven Development.

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).

Gil Zilberfeld

The Agile Zone is brought to you in partnership with JetBrains.  Learn more about the wide range of developer-oriented features to take your team's performance to the next level.  

Topics:

Published at DZone with permission of Gil Zilberfeld , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}