Demo TDD

Test Driven Development

  • One of the central ideas from Agile Software Methodology
  • But it has been applied too dogmatically
  • All your code should be covered by tests
  • But not all of it needs to be developed via test-driven-development

What is it?

  • It is always done with as an extension to automated testing
  • Core idea: write the tests before you write the code
  • Sounds counter-intuitive!
    • Allows you to think of making your API clean before you worry about how to implement it
    • Allows you to build up your functionality with confidence of a solid foundation
    • Prepares you to be able to introduce refactoring with confidence

Money Demo

  • Goal: A Money class
    • represent money in different currencies
    • What are all the operations you would want to do with them?
    • As a client how do you want to call them?
    • Discuss with a neighbor how you would write the test