Over a million developers have joined DZone.

What is the #1 Benefit of TDD?

· Agile Zone

Reduce testing time & get feedback faster through automation. Read the Benefits of Parallel Testing, brought to you in partnership with Sauce Labs.

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 Sauce Labs. Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure.

Topics:

Published at DZone with permission of Gil Zilberfeld, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}