There’s an old saying: There’s nothing new under the sun. Maybe there’s something to it. Details change, but the general patterns of things remain consistent. The wheel keeps turning, and if you live long enough you see the same spokes come around again and again.
James Shore, a well-respected figure in the software development field and the author of the highly-regarded book, The Art of Agile Development, has developed an approach to software development he has called a pattern language for testing without mocks.
I struggled to get started using James’ pattern language. Initially, I was trying to write code in two different ways in parallel – one using mocks and the other using the pattern language. I thought it would be interesting to apply the patterns to different types of languages and different programming problems. It was extremely frustrating. It seemed no matter what I did, I was breaking one of more of the “rules.”
Fortunately, James was willing to help me quite a lot, pointing out where I had gone astray and suggesting reference material to help me learn. He mentioned that people who have internalized testing with mocks often have similar difficulties picking up this approach, and that it requires a mindset shift.
That’s exactly what I was doing. I was approaching it from the perspective of testing with mocks and then seeing what would have to change to build the same solution using the pattern language. It proved to be a fool’s errand.
I paused and took a couple of days off from it. Then I read through all the material describing the various patterns and so forth. It struck me that what he was describing was very similar to the way we used to apply common application patterns in the 1970s-80s. By focusing on the comparison between “using mocks” and “not using mocks” I was missing the point.
Continue reading Template-Based Development Then and Now