Misplaced Responsibility: Mutant Builders

The Builder Pattern provides us with a useful way to instantiate objects. Builders decouple our code from concrete implementations. Builders make our code more readable, especially when used with a fluent interface. Builders make our code more cohesive, particularly when creating complex objects. The Builder Pattern is a very

Posted in Bad Code

Mockito-Collections RC-01

The first release of Mockito-Collections is now available. To use Mockito-Collections in Maven, add the following dependency to your POM. <dependency> <groupId>uk.co.webamoeba.mockito.collections</groupId> <artifactId>mockito-collections-core</artifactId> <version>1.0.0-RC-01</version> <scope>test</scope> </dependency> Documentation is available on the GitHub page: mockito-collections. To help get started, there are
Posted in Mockito-Collections

TDD and Toblerone

TDD and Toblerone may not seem like a natural combination, but it turns out they are well suited. At least if you apply a bit of Blue-Peter style sticky back plastic... So... one Toblerone box cut down to a sensible
Posted in Test Driven Development

Builders with Defaults

One of the times I find Builders particularly useful is when creating complex objects in tests. Often the test case will be influenced by something small within the complex object. To make my tests as readable as possible, I want
Posted in Simple Thoughts

Builders with a Fluent Interface

We use the approach described by the Builder Pattern to ease the creation of objects, especially complex objects. The premise is simple, we slowly gather the parts we want, until we build a complete object. It wasn't until I started using
Posted in Simple Thoughts

Is the test wrong – Is there a simpler test

Every so often when following TDD we struggle to make a test go green or we struggle to make a test go green in way that feels right. When this happens it can mean there is a problem with the
Posted in Test Driven Development

TDD – Small Leaps Of Amazingness

Test Driven Development is all about small verifiable steps. You write a little test, you write a little code, you get a nice green bar, you reshape the code, and that bar stays green. There are plenty of things that
Posted in Test Driven Development

There’s a Kata For That

I was recently thinking about how Programming Katas can help improve ones Craftsmanship. One of the big ideas behind Craftsmanship is Practice, or more precisely Deliberate Practice. According to the 10,000 hours theory you require 10,000 hours of Deliberate Practice
Posted in Software Craftsmanship

Where is the Controversy in Software Craftsmanship?

I recently gave a talk about Professionalism and Craftsmanship in the Software Industry to a group of my work colleagues. I thought I was well prepared, I had been very careful to read around the areas that I felt were
Posted in Software Craftsmanship

Keeping My Software on Track

It's a cold and rainy weekend, and I need something to do, so I open up my laptop and procrastinate for a while. That is to say, I avoid being productive in the fear that being productive might be boring.
Posted in Mockito-Collections