This is the first of several blog posts I am going to write about Growing Object Oriented Software, Guided by Tests (GOOS) by Steve Freeman and Nat Pryce. In this post, I describe my introduction to the book, and why I've decided to commit a fair bit of time to completing the book, and its worked example - the Auction Sniper.

Paul, meet TDD

I discovered automated unit testing in around 2003, and test first development a year or two later. At this time, my tests were primarily integration tests written in C# using NUnit. I developed a few systems using this approach writing thousands of tests, and becoming more and more frustrated with slow execution speeds, and the complex test setup required to write the tests.

When I first discovered test isolation through mocking, I saw it as a way of speeding up tests, and reducing test setup and it did deliver. It took a while however for me to start listening to the tests. TDD was still fairly immature, and the rapid evolution confused me - I really struggled with the often competing idioms such as Don't mock what you don't own, Mock 3rd party dependencies, Mock commands and stub queries, not to mention the Mockist / London School vs Classic TDD debate.

Paul, meet GOOS

I initially heard about GOOS at Agile Staffordshire in 2010. I purchased the book on Kindle, and read up to, and just into the worked example. The book struck many chords with my discovery of TDD, and in particular its advocacy of mocking as a design tool. I read this first section with enthusiasm, but never completed the Auction Sniper worked example; I was too busy learning Ruby and Clojure. I didn't want to spend a lot of time writing in Java, and I wasn't sufficiently confident in Ruby to attempt a translation. I put GOOS back in my 'to read' queue.


I'd been attending the West Midlands Ruby Users Group for a couple of years, and frequently discussions turned to unit testing. In particular, I recall several long conversations with Andy Henson (@elaptics) about 'better' object orientation than that commonly seen in Ruby on Rails projects, how Rails can be difficult to test, and how test driven development with isolation could possibly benefit Rails development. GOOS was mentioned several times, and my suggestion to read the book was validated by Steve and Nat being interviewed in a great Ruby Rogues episode.

The more recent 'Is TDD Dead' debate, and several conversations with friends and colleagues about the values, costs, and frequent brittleness of isolated unit tests spurred me on to attempt the book again. I suggested to Andy that we complete the book together, but this time using Ruby.

Recalling my first brief attempt at the worked example, I immediately knew using MRI Ruby would pose several challenges. RSpec is a significantly different testing framework than JUnit on which the book is based. Also, MRI Ruby doesn't have a UI framework similar to Java Swing as used within the worked example. Other complications like threading support, and static / duck typing would also complicate matters.

For this reason, we decided to use JRuby, and attempt to keep as true to the book as possible - using Swing through interoperability. We would use RSpec, and the Vines XMPP server.

The next post in the series will discuss the complications I faced in using JRuby to complete the Auction Sniper, and why I decided to complete the worked example in Java before revisiting using JRuby.

comments powered by Disqus