I always find I do a better job if I top-down my tdd work. I have a good context, goals are clearer, and the strategy doesn't get lost in the tactical work. It's such a good way to work.
On the other hand, I find myself constantly battling the urge to bottom-up the solution (and losing fairly often). When I bottom-up the work, I risk having a solution that doesn't really work in context and I have more rework. So what is the pressure that makes me want to bottom up?
I think it's because TDD is easiest when you are closest to a unit you're testing. It is easiest to isolate, and the tests are smaller and more clear than at higher levels. In addition, you never have a higher-level red test to ignore (or I've seen people comment them out) while you get a lower level test working.
I also think it has to do with the human "optimization drive" to skip all the navigation and jump to the file we think we'll have to change anyway. Maybe this is stronger in technical people, maybe not. It often works out just fine, but sometimes not.
I think I want to optimize away the "sometimes not".
No comments:
Post a Comment