Write Testable Code

I taught a TDD class for a very large client—one of the largest Internet properties in the world—and right before the class started, Monday morning at about 8:45, one of the senior managers came in and said, “I’m told you’re teaching a TDD class here.”

I said yes, and he replied, “We don’t do TDD here. We don’t want to do TDD here. Why are you teaching our people TDD? That’s wrong.”

I told myself, Okay, calm down. Take a breath. Then I said, “Honestly, I don’t care whether your developers do test-first development or not. What I care about is that they write testable code and TDD is the fastest way to show them how to get there.” And he was pleased with that answer. That made sense to him.

There’s a strong correlation between ...

Get Beyond Legacy Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.