Surprises
Back in the day I used to say this about test-driven development:
If ever I get a surprise, it means I have a missing test.
That is, if I'm in the GREEN or REFACTOR step of the TDD cycle and my changes make something else break unexpectedly, I need to add a test to document something that I must have missed previously.
I don't think that now. These days I am much more likely to say something like:
If ever I get a surprise, it means I have accidentally discovered some coupling that I was previously unaware of. I need to eliminate it, weaken it, bring the coupled code closer together, or refactor my names so that it is clearly documented.
The surprise tells me I've discovered some refactoring that needs to be done, because the code contains some Implicit Coupling. In this newsletter I will be talking about Implicit Coupling — why it’s what slows us down, how to recognise it, and what to do about it. The next article will work through one simple example that hit me just last week.