possible causal point for a failure to value TDD: geeks thinking the main source of bugs in professional software is not handling the main case successfully.
in any feature in any app, there are one or more primary cases. a given story is likely to be concerned with one of these at a time. when you’re geek-young, the great challenge is just to close out the primary case. hell, you barely learned the syntax, you’re just learning the library-set. just getting that primary case running is a big deal.
it takes a while, but with some practice, these primary case problems get easier and easier. you learn the syntax for real. you’ve used enough of the library to suspect or increasingly know how it was intended to be used. you are getting stronger, and that’s great. you find yourself making solutions in your head before you’ve even heard all the problem. and altho that has its own risks, you generally are making headway all the time.
when you go pro, tho, three factors emerge, all of them based on size.
because your app is larger, there are more people changing it, more cases to grasp, more things to remember.
- more people means more worldviews. assumptions you’ve made in your code are quite likely not the assumptions made in theirs.
- more cases to grasp means more possible code-paths. assumptions you’ve made about when and where and why your functionality is being called are far more difficult to make.
- more things to remember means slower and slower thinking. human brains are optimized for a very narrow bandwidth. no matter how much you resemble an encyclopedia, sooner or later you become nearly paralyzed.
and somewhere in this not-quite-so-geek-young phase, you will hopefully begin noticing that standing up the isolated main case really just isn’t that hard, comparatively. you bone up on design, which isn’t mostly about solving isolated main cases anymore. it’s about a new level of the game. (like when you finally realize potting simple pool shots isn’t the hard part of pool, or that bouncing between knit and purl isn’t the hard part of knitting. there are lots and lots of games-for-a-lifetime, and geekery is one.)
after a while spent learning the patterns and their beautiful variations, experiencing the joy and despair of walking around chanting “it’s really just an X. *everything* is just an X. it’s X’s all the way down!” you reach yet another game. you begin to understand how much time and energy you are spending on problems caused by assumption mismatch and tacit knowledge and trivial one-liner flaws.
TDD — really a shorthand for me for “the modern synthesis of software development” — offers a variety of ways to mitigate or even eliminate that pain. and as you adopt it, your successes increase, and your failures decline. and blammo, you’re a pro. this isn’t a switch, it’s a process, and it takes time. fortunately, you have time, cuz it pays back almost immediately.
and now you’re in a place where you can look back on those other periods and ask, would TDD have helped me even then?
my answer: yes, oh hell yeah. because those assumption mismatches, tacit knowledge failures, and one-liner flaws, THEY WERE COSTING ME THE WHOLE TIME. i just couldn’t see it. “just make the isolated main case actually run, please lord please,” was all i could attend to. tho i felt like the isolated main cases were the hard part, i was wrong. the hard part was *still* what it is now: assumption mismatch, tacit knwoedge failure, one-liner flaws.
i’m old enough to have climbed many mount stupids, and the odds are good that i’m climbing one just now. but at my current stage in the game-for-a-lifetime called geekery, i believe that TDD would have walked me through all the earlier stages far faster.
TDD is so powerful because it lets you kill off so many distractions from “just get the next main case working.”