Friday, June 22, 2012

Conventional Debugging vs. TDD


Conventional Debugging vs. TDD


Conventional 

  • Write 10s of lines, run, hit bug: break out debugger
  • Insert printfʼs to print variables while running repeatedly
  • Stop in debugger, tweak/set variables to control code path
  • Dammit, I thought for sure I fixed it, now have to do this all again

TDD

  • Write a few lines, with test first; know immediately if broken
  • Test short pieces of code using expectations
  • Use mocks and stubs to control code path
  • Re-run test automatically

No comments:

Post a Comment