Test Driven Development

Summary

To review (Kent Beck's TDD By Example):

  • Red/Green/Refactor cycle
  • Test first (Red)
  • When implementing
    • "Dumb"/"Quick" implementation
    • Obvious implementation
    • Triangulation
  • When test passes (Green)
    • Remove duplication (Refactor)
  • Todolist tasks
  • Small steps when not sure
  • Larger steps when confident or obvious
  • Tests should show intent
  • Refactor code and tests
  • Emergent design

TDD done right should help:

  • reduce debugging time
  • produce reliable documentation from written tests
  • improve code design (decoupling...)
  • refactor code confidently (suite tests acts as a parachute)