News for hackers. Stuff that matters.
Re:Where unit testing fails by tychof on Monday July 25, 2011 @09:13AM (#2802446)
One benefit to TDD is that you become a user for your API much more quickly, and so your API doesn't need to change as much.

TDD suggests 3 steps: 1. Write one test 2. Write the minimal code to make it pass 3. Refactor the code you've got.

Try not to think of tests as immutable. You can throw away tests when they don't provide value.

Finally, make sure you're using an IDE with refactoring support. That helps immensely when you make an API change which will affect your tests.

Re:Where unit testing fails by berntb on Monday July 25, 2011 @10:19AM (#2802697)
OK, thanks to you and zumda.

Interesting TDD argument. I'll buy a book or something and try again when my present hobby project is done and I have time for experimenting.

(IDE refactoring needs a stricter language than I prefer. Also, without an IDE and using my old eyes I have 2 A4 of code + 1 A4 of bash on a 24" monitor...)

Re:Where unit testing fails by zts on Monday July 25, 2011 @12:16PM (#2803212)
If you're looking for book suggestions, I'd recommend "Growing Object-Oriented Software, Guided By Tests" by Steve Freeman and Nat Pryce. It's pretty pragmatic, and the treatment of the subject is pretty thought-provoking (at least, I thought so when I read it).

The examples are all Java, but the accompanying website (http://www.growing-object-oriented-software.com/) has links to reimplementations in several other languages.