Testability

May 25, 2010 00:55

So, a while back, I said, "Also, I don't consider testability to be a good goal. However, I'm being argued down on that, so it's kinda malleable."

Leaving WhitePages meant that most of the forces arguing me into favoring testability have been conveniently silenced. And now this pops up:

http://blogs.msdn.com/b/cashto/archive/2009/03/31/it-s-ok-not-to-write-unit-tests.aspx

I'm not saying there's a direct linkage; I'm an intuitive person, not a logical one, so I work with indirect linkages 99% of the time anyways.

So, I don't think testability is a good measure of code quality. I think it's a strictly secondary goal: if you aren't sacrificing anything meaningful to achieve testability, then sure, make it more testable. Usually, people argue it from the other direction: making something more testable automagically makes your code better designed.

There's some merit to that argument, but I haven't found it convincing. It might be because I don't write enough library-level code: most of my code is user-facing, minus one or two layers of indirection, so testability means being semantically logical, which is itself a good goal. The fact that it means it's also testable is incidental, not primary.

code

Previous post Next post
Up