Tuesday, July 29, 2008
A recent object mentor blog entry said:
We had an interesting result during that class. One group was practicing Bob’s three rules of TDD (paraphrased);Maybe the cause of the mess were the rules they used. I remember the rules more like this:
But they ended up with a bit of a mess. Following the three rules wasn’t enough. These rules are guiding principles, but those three rules mean nothing if you forget about clean code, refactoring and basic design principles [...]
- Write no production code without failing tests
- Write only enough test code so that it fails (not compiling is failing)
- Write only enough production code to get your tests to pass.
- Write enough test code so that to get a single test failure.
- Write enough production code to get all your tests to pass.
- Refactor until the code is Simple/Clean. (See elsewhere for the Rules of Simplicity/Clean)