TDD by Beck – Chapter 13 code on GitHub

The code for Chapter 13 of Beck has been added to GitHub with the following commit message:

Ch 13: Make It

There was data duplication initially, because we had a test that was passing because of a hardcoded response in the reduce method of the Bank class. It was returning 10 – so when a test was written for the Bank reduce, and written in a way that it had a different value expected, it caused us to be forced to correct the situation.

We started to work forward to find the implementation – breaking tests as we went, and refactoring by introducing the Sum class, until it passed at some level.

It passed – though the code had some casts that were pretty unappealing – and ths seemed to call out for polymorphism as the solution. As a result, the method “reduce (String paramName)” was introduced into the Money class, so that it could be put into the Interface class Expression. This lead to a cleaner implementation of the Bank’s reduce method.

This entry was posted in TDD, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s