Revisiting "X Improves My Design"
I seem to have upset a few people. Let me clarify a few points about the last article I wrote:
- I don’t think unit testing or test-driven development is a bad idea. I’ve done it for some time. I’ve argued for it. I’ve invited Mark Clark to speak at user groups to promote TDD. If this post is read as a hit piece on the idea of test-driven development, that’s not how it was intended. I’m not the right person to write such a hit piece, because I think TDD is a good idea.
- Nothing in the article was intended to attack or insult Tim Ottinger. It was meant to point out something we all do, and that I think we need to be made aware of. I do it with functional programming and static typing. Others do it with OO design, or certain kinds of version control, or whatever. Tim wrote a good article, and I used it as a springboard to make a slightly related point. I do apologize to Tim if my comments were upsetting at all.
- I don’t actually believe that doing test-driven development requires completely giving up private variables. I don’t think it necessarily means adding Java EE style abstract factories for all classes in the program. I was pointing out, more than anything else, that we should just remain aware that these techniques have disadvantages.
The main thing to bring away is there there are very few techniques in programming that don’t make some things hard or awkward. Denying that fact is dishonest, and does nothing to help the advocacy of a technique. Acknowledging it brings us back to real people balancing real and often conflicting concerns in the context of their various projects. This is the essence of software development, and it’s directly opposed to the human tendency to pick a side and defend it against all comers.
I remain convinced that test-driven development will lead to some design compromises in other areas. I’ve seen it in my projects, and I think Tim’s experience basically says the same thing. I still think it’s best that we describe these compromises as what they are. It’s important to resist silver-bullet-ism in a field that’s already gone too far down that path.