On 10/25/07, Andrew Lentvorski <[EMAIL PROTECTED]> wrote: > Bob La Quey wrote: > > On 10/24/07, Andrew Lentvorski <[EMAIL PROTECTED]> wrote: > >> Something about actually seeing a mountain of unit tests seems to scare > >> off the cowboy coders. > >> > >> -a > > > > This sounds true to me. I suspect is is also true though > > that a mountain of unit tests can be a giant pile of shit that > > enforces a poor solution to a problem. > > Have you seen this? This is a problem that I have *never* seen. Not once. > > It's hard to enforce a particular solution through unit tests. > > Anyone writing a unit test that isn't working for some company has > motivation to do so. > > Even inside a company, by defining unit testing as: > > 1) You may not break any other unit tests. > 2) You need to write the unit test, and it must fail on the old code. > 3) You need to fix *only the code* and it must now pass the unit test > > It really cuts to the meat of coding. > > Besides, unit tests let the programmer tell me *exactly* what defines > "correct" code. The programmer has to define "correct" in some way. > What better way than in code? > > It's not like programmers would prefer that I make them define correct > by writing documentation. > > > At least half the time I will go with the cowboys. > > Sorry. Pass. > > No unit tests, no dice. > > -a
The point that I am getting at here is that unit tests do define the code. They define the units. If the code is very poorly designed then the units are wrong. If by enforcing the unit tests you enforce the bad design then you have locked yours3elf into a straitjacket and have no way out. Some large systems simply need to be ditched. One must occasionally start over. Maybe that is the point though of your rule 2? > 2) You need to write the unit test, and it must fail on the old code. Unit tests are fine. But they do constrain. That is their purpose. There are times when one will be better off busting the constraints. I have no problem with the demand that when one starts over that one plans and uses unit tests from the get go. Now that I like. BobLQ -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
