News for hackers. Stuff that matters.
Re:Good code needs few unit tests by andreyf on Friday March 19, 2010 @04:49PM (#1205235)
The argument is that good code [...] requires fewer unit tests

Great point, my mistake. Title and headline updated (was: Good code has few unit tests). I really wish it were "duh", but measuring code quality by "unit tests per line" [1] is frighteningly common, and seductive in its simplicity and intuition.

1. Not necessarily directly. It might be in the form of "I'll add more unit tests to improve this code" (unit tests either cover an interface or they don't; going in to 'add more unit tests' to 'improve' code means you didn't define a clear enough interface to begin with). Or "our open source project has more unit tests than another" (but I won't point fingers).

Re:Good code needs few unit tests by nostrademons on Saturday March 20, 2010 @04:04AM (#1206163)
But "unit tests per line" is a good metric. Why? Because programmers (well, at least I) hate writing unit tests. If you have a high unit-tests-per-line ratio, then writing one fewer line of code will let you avoid writing several lines of unit tests.

The easiest way to bump your unit-tests-per-line metric is to delete lines of code. That's a positive thing, in my book.