Conventional wisdom is a pet peeve of mine. People call something "conventional wisdom" when they don't want to spend any time justifying it. Similarly, people (like you) want to do whatever they want that goes against conventional wisdom without justifying it either. These are lazy habits of thought. Both of them. Want to talk about DRY? OK. DRY is justifiable on the basis that when a block of code is found to be incorrect or requires updating, hunting down all the related blocks of code is a maintenance nightmare. Is DRY appropriate for every little three-line programming idiom? Probably not, because the idiom itself is unitary. Probably. Unless the developer is likely to make mistakes in a little three-line idiom. DRY is about copy-pasting whole screenfuls of code. Like any conventional wisdom, you have to know how to follow the rules before you get to break them. Want to talk about testing? OK. We write tests alongside the original code to check out its interfaces. The test code may never find an error, or you may forget that you found and fixed the error as you were writing the test, but once the interface is stabilized, the test will probably never fail again. Except that the other reason we write tests is that if we must change the implementation, the test ensures that the change doesn't break the interface. We write tests because it is easier than predicting the future. A test may never fail, but we don't know that when we write it. When we change the implementation and a test does fail, we don't have to ship broken code to customers to find out we've made a mistake. Tests are an insurance policy. Most of the time, you don't crash your car, but when you do that insurance pays for itself. Not writing tests is only an option if your initial code never contains bugs and your clairvoyance about future changes is perfect.
> People call something "conventional wisdom" when they don't want to spend any time justifying it. I think this is at the core with what I don't like about conventional wisdom or calling something an "anti-pattern." My next post is probably going to talk about lazy thinking and how calling something an anti-pattern is an anti-pattern.