Title: Responsibility Driven Design with Mocking

Presenters: Marc Evers, Willem van den Ende & Rob Westgeest

Objectives:

To show how interaction based testing drives Responsibility Driven Design

Intended audience:

Developers who know do TDD and are interested in improving their practice..

Contents

Responsibility Driven Design is a concept coined by Rebecca Wirfs-Brock and is about good object oriented design. OO design is about assigning the right responsibilities to the right objects and developing a clear design with loose coupling and high cohesion.

Test Driven Development (TDD) guides you in that direction, but not far enough. TDD helps to get loosely coupled objects, because having too many dependencies will get in the way of the test-code-refactor rhythm.

Testing with mock objects takes it a step further. The focus shifts from state to interactions - the messages objects send to each other. Testing with mocks emphasises behaviour and responsibilities.

In this session with a live (pair)programming demonstration, we will show how using mock objects helps to develop in a responsibility-based instead of a state-based way. We will also show how this approach enforces the Tell, Don't Ask design principle.

This session was quite successfully presented at the JSpring 2008 conference (in Dutch).

Format and length: 60 minutes presentation and demo