From: Gavin Sinclair Date: 2002-08-10T19:01:26+09:00 Subject: Re: Unit testing is considered harmful ----- Original Message ----- From: > Hi -- > > > > Coincidentally, I submitted a question about this--CodingChallenge0002 > > vs. unit tests--to the extreme-programming mailing list this morning. > > I was commenting on my surprise that we kept adding unit tests after > > the fact, and breaking existing solutions. I referred people to the > > wiki page. What happened is people replied back with detailed > > questions, specifically stating that the requirements were too vague > > and asking for clarification. . . . Which is just what happened here on > > ruby-talk when the challenge was first announced. [[Not pointing > > fingers!! I enjoyed the challenge and learned a lot from it.]] > > I guess ideally this kind of thing would be either on a wiki *or* on a > mailing list, but not both. It's probably the fault of my quirky > habits: I liked the idea of putting the problem and the solutions on > the wiki, but for whatever reason I tend to be more at home with > email-based than wiki-based discussion. Oh, and people did ask > questions here on the list :-) Spreading the requirements around is a problem, but in these circumstances completely expected. The reality is that if this were a serious problem facing a paid developer, they would surely pinpoint requirements. It was a difficult problem to viaualise (in computer language, anyway; I've never had any problem with the mathematics of 1-1 correspondance), so misunderstandings were rife, and in short it wasn't a great experiment if one's aim was to test unit testing. > > It certainly has been an interesting little case study. Yes, I wish I had the time and sufficient understanding to submit an entry. When's the next one? > > David Comment on unit tests in general: you have to - to some extent - prove your program correct, and put lots of sanity checks in the code (i.e. invariants); but unit tests are *really* useful for just being able to repeat manual tests. Not an insightful comment, but so long as you don't abuse them by relying on them too much, they're great! Oh, another comment. Many applications are a lot more "practical" than the textbook examples we always hear (and was repeated here with balancing trees or some such). These apps are IO-intensive, specific-calculation-intensive, or whatever. They don't usually fit the mould of rigorous requirements analysis, proofs and invariants. How I wish a book were written that broke this mould. Suggestion, anyone? Gavin