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 #1: Uncle Bob's Three Laws 

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 #2: F.I.R.S.T Principles

Card #3: Core of TDD

  • Red: test fails
  • Green: test passes
  • Refactor: clean code and tests


Card #3: Core of TDD
By the way, if you’re in the Montreal/Quebec sector and you’d like (or perhaps your team) to know more about TDD (unit testing best practices, patterns of unit testing, introduction to Mock Objects, etc.), I highly recommend taking the two-day Test-Driven Development in .NET training course with us at the CRIM. 

This post has been viewed: 8490 times. kick it on DotNetKicks.com

 

Similar posts you might be interested in reading:

5 Comments

  1. Tim:

    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. :-)

  2. Brian Di Croce:

    Tim,
    Ha! Don’t tell me one of the cards shows a pig and a chicken having breakfast at some bar! ;)

  3. DO:

    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.

  4. TDD en trois fiches - 6502.fr:

    [...] Di Croce a résumé le TDD en trois fiches dont voici la [...]

    [WORDPRESS HASHCASH] The comment’s server IP (91.121.205.87) doesn’t match the comment’s URL host IP (87.98.138.142) and so is spam.

  5. Tim Ottinger:

    I am now creating a whole deck of agile flash cards in the same vein. I am working with successful author Jeff Langr (Agile Java, et al) who was also a contributor with me in Clean Code. We’re working publically at http://agileinaflash.com/ in case you want to come help us with comments and criticisms.

Leave a comment

Powered by WP Hashcash