Three Index Cards To Easily Remember The Essence Of Test-Driven Development
As I was reading a couple of ObjectMentor’s blog posts, one of them caught my attention. It was Tim Ottinger’s post on “TDD on Three Index Cards“. He recalls how someone missed part of a class he was teaching on TDD and told that individual the fundamental essence of TDD on three index cards in less than 15 minutes. After reading that, I got myself thinking “Hhhmm…not a bad idea! I wonder if it’s physically possible?“.
Ten minutes later, I’m at Staples buying some index cards and a couple of markers (for pictures purposes…of course…). Here’s the final product which every credit goes to Tim for this very simple, practical and useful idea. Kudos to my wife for taking the pictures.
Here’s a recap of the main ideas behind TDD (full credits goes to Tim):
Card #1. Uncle Bob’s Three Laws
- Write no production code except to pass a failing test.
- Write only enough of a test to demonstrate a failure.
- Write only enough production code to pass the test.
Card #2: FIRST Principles
- Fast: Mind-numbingly fast, as in hundreds or thousands per second.
- Isolated: The test isolates a fault clearly.
- Repeatable: I can run it repeatedly and it will pass or fail the same way each time.
- Self-verifying: The Test is unambiguously pass-fail.
- Timely: Produced in lockstep with tiny code changes.

Card #3: Core of TDD
- Red: test fails
- Green: test passes
- Refactor: clean code and tests

Similar posts you might be interested in reading:
- New Page Available for .NET Positions in Montreal
- Most popular posts for March 2008
- Jay Flowers on Continuous Integration (MSDN Magazine - March 2008)
- Better Modelling with the Visual Studio Class Designer
- What Test-Driven Development Has Taught Me So Far
- Setting Up a Continuous Integration Environment (Preface)
- Book Review #7: "The Dip: A Little Book That Teaches You When to Quit (and When to Stick)"
March 19th, 2008 at 5:50 pm
I wish I’d posted the cards. Ah, there is not always a camera around when I need one.
You should see mine on Scrumming on two cards.
March 19th, 2008 at 6:18 pm
Tim,
Ha! Don’t tell me one of the cards shows a pig and a chicken having breakfast at some bar!
March 20th, 2008 at 1:41 am
If Dijkstra was looking over Uncle Bob’s shoulders he might tell him to add Card #0 for proof driven development, to prove the solution to yourself before implementing said solution with TDD.