DEV Community

ruthmoog
ruthmoog

Posted on • Updated on

Book Club: "Test Driven Development: By Example" #7

Chapter 7: Apples and Oranges

This is a very quick chapter that makes some very important points. We decide to expand our .equals method to compare class rather than say, currency.

  1. We would like test criteria to make sense in the real-world domain (in this case finance), rather than only in Java-land.

  2. But, we will only do as much work as is reasonable, i.e. in our test we're taking advantage of what's available to us in the existing Java, but acknowledge that's not ideal.

My assumption here is there's no point getting ahead of ourselves and over-designing upfront the currency comparison - we will come to it when it's necessary to do so and our TDD process takes us there. We've added 'Currency' to the To Do List so it won't be forgotten.

🔎 View my code-along repo at https://github.com/ruthmoog/test-driven-development-by-example


Book cover Kent Beck's "Test Driven Development: By Example" was released in 2002. The book aims to explain how to use TDD to write quality code that works.

Top comments (0)