DEV Community

ruthmoog
ruthmoog

Posted on • Edited on

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

Chapter 11: The Root of All Evil

I felt some uneasiness at this chapter. Here we finish removing the duplication between Dollar and Franc, but recognising those classes have served their purpose, we can get rid of them.

Having completed this chapter a while after removing the duplicated methods within those classes, this felt a bit strange. Essentially these classes had no responsibility other than their constructor, which is not sufficient purpose. These classes mapped to my understanding of real money, so I was sad to see them go. But, we still have the concept of currency which Money is taking care of.

If we need a Dollar or Franc class some day, we can write one, no sweat.

In addition we removed some duplication in the tests, which made me very happy! Tests are much easier to name when they don't step on another tests' toes.

🔎 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)