But a common situation is that I have only a vague understanding of where we're headed. I don't know how my dependencies work. I don't know how it should all fit together. So:
- Write a spike in the form of a "unit" test.
It's not really a unit test, because it's not testing a unit. But I'll still use a unit testing framework to write it. And I'll use FluentAssertions and ApprovalTests if they're useful
Like any good spike, it should hit the tricky parts, like an API that is poorly documented.
It may take a while to write. I'll try lots of different things until I get it to work.
- Extract 'till you drop
Use Extract Method, Extract Class, Move Method repeatedly.
Look at any primitives as potential new classes (Whole Value).
Keep refactoring until things read really cleanly. Avoid generality that you don't already need, though.
Keep refactoring until things read really cleanly. Avoid generality that you don't already need, though.
- Keep testing.
If a method is hard to test, refactor.
If a method is hit by more than 4 tests, refactor.
- RGR
Add new functionality with the standard Red-Green-Refactor cycle.
1 comment:
I just heard that Dan North (of BDD fame) calls this "Spike and Stabilize".
Post a Comment