TDD by Beck – Chapter 14 on GitHub

The code for Chapter 14 of TDD by Beck is now on GitHub

 

CH14: Change

Significant techniques are introduced here...though I had issues with Java 6 indicating that some methods (assertEquals(Object{}, Object[]) is deprecated.

* Added a Bank parameter
* Saw that the number 2 was duplicated in code and tests - so refactored it out from it as part of the rate
* A test for the ArrayEquals showed an assumption that did not work - so drove the direction of the solution....which was a separate class as a comparator (Pari)
* Wrote that (without tests!!!) as it was part of a refactorying.
* When there was an error - it forced a new test testIdentityRate() - which isolated the problem.
Posted in TDD | Leave a comment

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.

Posted in TDD, Uncategorized | Leave a comment

TDD by Beck – CH 12 code on GitHub

The code for Chapter 12 of TDD by Beck is now on GitHub.

CH 12 - Addition, Finally

In this chapter, we take a big test - which is addition cross-currencies, and reduce it to a simpler case of addition in a single currency.

Wiht that - we have a metaphor - Expressions - which are currency independent - think of them like a wallet.  Operations result in expressions - and if we think of the multiple ways that a currency combination in a wallet can have the same value - we introduce a "bank" as a way of converting to a single currency value at the end.

This means - Expression will operation on Money.
Then create a bank.
Have the bank reduce the value to USD (for example)
Posted in TDD, Uncategorized | Leave a comment

TDD by Beck – Chapter 11 code on Git

The code for Chapter 11 (“The root of all Evil”) of TDD by Beck is now available on GitHub.

The commit notes on Git are as follows:

 

The intent is to remove the Dollar/Franc duplication.
Removed Dollar - and checked for references to Franc.
There were some - though the tests were sufficiently covered elsewhere that it was not worth keeping the testDifferentClassEquality.
At the same time the "testFrancMultiplication" - can be removed - though I would advocate keeping it, personally.

Beck says that no system confidence is lost if you remove it - and as the system is relatively well understood, that is okay, in more complex cases, this may not always be the case.
 Redundant code is important to remove at the same time - keeps things clean and limited to what you need, and what you want to spend time reviewing.
Posted in TDD, Uncategorized | Leave a comment

CH 10 of TDD

The code for Chapter 10 – “Interesting Times” – is not on GitHub.

Posted in TDD, Uncategorized | Leave a comment

Ch 9 of code for TDD

Currently on GitHub

Posted in Uncategorized | Leave a comment

Ch 8 code for Tdd now on GitHub

The code for Chapter 8 of TDD by Beck is now on GitHub.

Posted in TDD | Leave a comment