Introducing TDD on Page 169 of Agile Web Development with Rails

Walk before you run. So even in a TDD framework approach like Rails the concept of TDD is only approached and explained on page 169 of Agile Web Development with Rails. And even in a chapter on testing we begin with writing functional database style unit tests, and then functional style tests against the controllers. Finally, on page 169, we’re introduced to test driven development.

I don’t fault the writers of Agile Web Development with Rails for the approach and certainly not Mike Clark who has made important contributions to TDD and is extremely lucid technical writer. I fault the current level of adoption of TDD.

I think the authors made a reasonable assumption that many of their reader base wouldn’t be familiar with TDD. Thus you get through building the example application before you bring up the subject of testing. Since many readers come from backgrounds like PHP it is unlikely they’ve ever touched a unit test framework or tool before.

I still would have enjoyed if they blazed a trail and started out doing TDD. Just gone ahead and explained the approach in chapter one and then used it to build the example application. This would have forced a title change like Test Driven Development with Rails since the only books that cover the TDD approach up front have TDD somewhere in the title like Test Driven Development: A Practical Guide.

Maybe in the next few years we’ll see technical books that aren’t on TDD, that just use TDD in the examples by default.

4 comments to Introducing TDD on Page 169 of Agile Web Development with Rails

  • I had this possible future in mind today when I asked the question on the TDD mailing list “what content should be in a certification program for developer testing?”

    As I explained there it isn’t that I have a love for certification programs, I just want the practices to be mainstream, and if they are mainstream there will be a certification program.

    And when they’re mainstream the books won’t need to explain why they’re using TDD, it’ll just be how things are done.

  • I’m not crazy about the idea of certification when it comes to TDD because it’s still an evolving practice. A couple of years ago you probably would have found most agilists perfectly happy with the notion of writing unit tests soon after writing code. There were/are a lot of comments on the web saying test-first is just a “flavor” of TDD. Today the “mainstream” practice is test-first, but already we’re moving beyond that idea and toward BDD and similar approaches that eschew the word “test” altogether. If we lock practices down with a certification exam, isn’t there a risk of stalling innovation?

    BTW when I worked through that Rails book I wrote unit tests first out of habit, notwithstanding the order of presentation in the book. Maybe TDD wasn’t supposed to be the topic of the book so they just took it for granted.

  • My experience is that TDD isn’t all that mainstream yet, but that’s mostly anecdotal evidence.

    I’d say that my general rule is that certification programs can be quite dangerous, the best example of this is probably PMI’s PMP. But on the other hand the proof of getting a TDD type certification would be to actually program some assignment complete with tests. Not sure how you’d ascertain they wrote the tests first, but a novel idea.

    I thought about doing the first part of the book TDD as well, but just to experiment I went ahead and followed along with the examples. I took the typical TDD approach going through the Ruby Pickaxe book.