BDD / TDD criticized

,

I think one issue that isn’t doing TDD any favours is what Kevlin Henney calls “Test First - dumbed down” - training that focuses on Red/Green, totally bypassing “Refactor”!!

Make it work, make it right, make it fast.

Red/Green only pays attention to make it work. But good software needs to go further and that requires skillful refactoring (which goes beyond the automated refactoring facilities included in modern IDEs).

He tweets:

The more I teach TDD, the more I see the Red–Green–Refactor mantra as misleading. It obscures intent and puts wrong emphasis on activities.

suggesting alternative “mantras” like (Deming/Shehart Cycle):

  • Plan: Write test for what you want
  • Do: Make it so!
  • Study: Could anything be improved?
  • Act: Make it so!

or (The 4 R’s):

  • wRite: Create or extend a test for new behaviour - as it’s new the test fails.
  • Reify: Implement so that the test passes
  • Reflect: Is there something in the code or tests that could be improved?
  • Refactor: Make it so!

:wink:

or:

  • C: Codify intent as test :cat:
  • A: Actualise intent in code :cat:
  • T: Try considering alternatives :cat:
  • S: Select action :cat:
2 Likes