I’m starting to move away from Law-of-Demeter-esque TDD unit testing, and towards Michael-Feathers-style inflection-point testing (regardless of whether it’s legacy code or not). And why? My work on very fine-grained objects in Kew has prompted some changes in my thinking.
I want to make objects so small and simple it’s not worth writing automated tests for them. And yet, I want to test them. So, I can either burn lots of time writing almost pointless fine-grained tests, or I can group my tests around inflection points in the system. I have yet to work out how to do this effectively, but I feel that Michael Feathers’s ideas about inflection points in legacy code hold some clues. I feel this concept can apply to TDD as much as to legacy code. And that would bring the legacy and green-field worlds together. Which is where they should be.
In the wider world, we’re seeing some evidence of these kinds of fine-grained object models being on the rise. These models have many simple operations that gain their power when composed.
Objects are getting smaller.