Sunday, January 25, 2015

Kata: Bank Account in Java

Álvaro and I have been pairing lately to do a subset of the Bank Account kata that Sandro Mancuso proposed as an exercise in his Crafting Code course.

We had to write and make the following acceptance test pass using Outside-In TDD:
Given a client makes a deposit of 1000.00 on 01/04/2014
And a withdrawal of 100.00 on 02/04/2014
And a deposit of 500.00 on 10/04/2014
When she prints her bank statement
Then she would see

DATE | AMOUNT | BALANCE
10/04/2014 | 500.00 | 1400.00
02/04/2014 | -100.00 | 900.00
01/04/2014 | 1000.00 | 1000.00
The goal of the exercise was to understand the outside-in or London-school TDD style.

After the course Álvaro and I continued working on the exercise.

We had many difficulties to get used to this style for several sessions because we weren't used to test behavior instead of state. We struggled a lot because we were working outside of our comfort zone. In one of the sessions, we rushed too much trying to move forward and make the acceptance test pass, which resulted in allocating some of the responsibilities very badly.

In the end, we managed to get out of the mess we got in by slowly refactoring it to a better design.

All in all, it's been a great experience and we've learned a lot pushing our limits a bit further.

Unfortunately, we didn't commit the code after each tiny step this time, only at the end of each pairing session.
You can find the resulting code in this GitHub repository.

As usual, it's been great pairing with Álvaro, thanks mate!

No comments:

Post a Comment