Part 5: TDD on application architecture level

Designing automation layer

Adapting screenplay pattern

code in terms of intention (when knowing more about intention) refactor the domain-specific API (when knowing more about underlying technology)

Driver

reusing the composition root

Separate start method

Fake adapters

They include port-specific setup and assertions.

Create a new fake adapter per each call.

Using fakes

For threads and e.g. databases - simpler objects with partially defined behavior

Actors

Where do assertions go? into the actors or context?

How to manage per-actor context (e.g. each actor has its own sent & received messages stored)

These are not actors as in actor model

Data builders

nesting builders, builders as immutable objects.

Further Reading

Motivation – the first step to learning TDD

  • Fearless Change: Patterns for Introducing New Ideas by Mary Lynn Manns Ph.D. and Linda Rising Ph.D. is worth looking at.
  • Resistance Is Not to Change by Al Shalloway

The Essential Tools

  • Gerard Meszaros has written a long book about using the XUnit family of test frameworks, called XUnit Test Patterns. This book also explains a lot of philosophy behind these tools.

Value Objects

  • Ken Pugh has a chapter devoted to value objects in his book Prefactoring (the name of the chapter is Abstract Data Types).
  • Growing Object Oriented Software Guided By Tests contains some examples of using value objects and some strategies on refactoring towards them.
  • Value object discussion on C2 wiki.
  • Martin Fowler’s bliki mentions value objects. They are also one of the patterns in his book Patterns of Enterprise Application Architecture
  • Arlo Beshele describes how he uses value objects (described under the name of Whole Value) much more than I do in this book, presenting an alternative design style that is closer to functional that the one I write about.
  • Implementation Patterns book by Kent Beck includes value object as one of the patterns.