XP pioneer stumps for test-driven development

A pioneer of Extreme Programming and test-driven development, Ward Cunningham is also the inventor of Wiki, a popular open source tool for Web-based collaboration. Jon Udell asked him to reflect on lessons learned as a practitioner of TDD and to describe how FIT (Framework for Integrated Test) enables programmers and business analysts to collaborate on testing business scenarios.

Q: What's the driving motivation for test first (see Test before you leap for more on this development methodology)?

Cunningham: Not so much finding that last bug, but guiding the development in a way that doesn't require a lot of attention to details. Then you can think and act strategically. The best developers are now very interested in testing, but they want testing that benefits them immediately.

Q: What makes test-first feasible?

Cunningham: We presume that it's easy to write tests, and that wasn't always true. With Cobol, there was no way to reach into the middle of your program. Now it's much more likely that your program is a network of objects. You can reach in and grab any one of them.

Q: What are the social implications of test first?

Cunningham: Developers use tests to communicate with other developers. The social contract says, "Here's my code, do anything you want with it so long as you have and run my tests. You're unlikely to hurt me if you continue to pass those tests. If you do fail a test, come talk to me."

Q: Some say test first is sustainable because programmers get to do what they like: writing code, not documentation.

Cunningham: There may be some truth to that. However, when you're writing code, you're focused on a single goal. When you're writing a test, you're deciding, "Of all the goals I know I have, what goal will I focus on next?" It's a sequencing thing. Do I take a little step or a big one? And how am I going to check that step?

Q: People report that the constant positive reinforcement -- the green bar that means the tests have passed -- is a powerful motivator.

Cunningham: It's true. You take a step, it seems small, but you get that reinforcement -- it's done. It's amazing how little reinforcement we've gotten over the years as we've gone through weeks and months of coding; you can get almost into despair.

Q: Where does FIT come in?

Cunningham: How do you have a rich conversation about a program that doesn't yet exist? Nowadays we focus on the UI, but complex business scenarios -- like an out-of-sequence endorsement on an insurance contract -- don't show up on the screen. Fortunately, folks who think about such things tend to work out these cases on spreadsheets. With FIT we can turn that spreadsheet into a Web page that the software tests read and update.

Q: So the programmers and the business analysts are literally on the same page?

Cunningham: Yes. The person-to-person communication is still the richest source of insight into what's required. But at some point you want to write it down, you want to say, "Here are some examples in my language as a domain expert, please check them mechanically, as you do your work, so that my interests are protected in the same way yours are."

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Show Comments