Agile Zone is brought to you in partnership with:

Gil Zilberfeld has been in software since childhood, writing BASIC programs on his trusty Sinclair ZX81. With more than twenty years of developing commercial software, he has vast experience in software methodology and practices. Gil is an agile consultant, applying agile principles over the last decade. From automated testing to exploratory testing, design practices to team collaboration, scrum to kanban, and lean startup methods – he’s done it all. He is still learning from his successes and failures. Gil speaks frequently in international conferences about unit testing, TDD, agile practices and communication. He is the author of "Everyday Unit Testing", blogs at http://www.gilzilberfeld.com and in his spare time he shoots zombies, for fun. Gil is a DZone MVB and is not an employee of DZone and has posted 70 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
| 7255 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.)