Agile Zone is brought to you in partnership with:

Gil Zilberfeld has been in software since childhood, starting out with Logo turtles. With more than 15 years of developing commercial software, he has vast experience in software methodology and practices. Gil is the product manager at Typemock, working as part of an agile team in an agile company, creating tools for agile developers. He promotes unit testing and other design practices, down–to–earth agile methods, and some incredibly cool tools. Gil speaks locally in Israel and internationally about unit testing, TDD, and agile practices and communication. And in his spare time he kills dragons, for fun. Gil blogs at http://www.gilzilberfeld.com on different agile topics, including processes, communication and unit testing. Gil is a DZone MVB and is not an employee of DZone and has posted 52 posts at DZone. You can read more from them at their website. View Full User Profile

What is the #1 Benefit of TDD?

04.10.2013
| 6882 views |
  • submit to reddit
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

Published at DZone with permission of Gil Zilberfeld, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)