O'Reilly logo

Test Driven Development: By Example by Kent Beck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Times We're Livin' In

$5 + 10 CHF = $10 if rate is 2:1$5 * 2 = $10Make “amount” privateDollar side effects?Money rounding?equals()hashCode()Equal nullEqual object5 CHF * 2 = 10 CHFDollar/Franc duplicationCommon equalsCommon timesCompare Francs to DollarsCurrency?Delete testFrancMultiplication?

What is there on our to-do list that might help us to eliminate those pesky useless subclasses? What would happen if we introduced the notion of currency?

How do we want to implement currencies at the moment? I blew it, again. Before the ruler comes out, I'll rephrase: How do we want to test for currencies at the moment? There. Knuckles saved, for the moment.

We may want to have complicated objects representing currencies, with flyweight ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required