«« Developers vs IT Staff Sweet Singles »»
blog header image
Kent Beck on XP Testing

I recalled correctly Kent Beck's opinion of testing in Extreme Programming Explained (1999). In fact he was quite concerned about developers adopting XP:

"... you should write the tests that help get programs working and keep programs working. Nothing more. Remember the principle 'Work with human nature, not against it' ... If we want programmers and customers to write tests, we had better make the process as painless as possible."

Then he goes on to say this about testing:

"You should test things that might break. If code is so simple that it can't possibly break, and you measure that the code in question doesn't actually break in practise, then you shouldn't write a test for it. If I told you to test absolutely everything, pretty soon you would realize that most of the tests you were writing were valueless, and, if you were at all like me, you would stop writing them."

So from this would I estimate that Beck is as thorough with his testing as I am? Probably not, but he's been coding a lot longer than I have -- he doesn't have to be.

Posted at December 07, 2003 at 03:42 AM EST
Last updated December 07, 2003 at 03:42 AM EST
Comments

"so simple that it can't possibly break"

Just leave it with a co-op student for an afternoon and he'll have to redifine what exactly that means. ;-)

I think that it's better to err on the side of caution because you don't know what will happen when maintainers are changing your code, or what happens when placed with other modules that do things that you didn't think were possible.

This summer I was working on code written by a very experienced people, just hitting the exe, and not changing the code. I saw on the screen many times the result of this code "printf("this line is unreachable");". Ya, right.

» Posted by: Jim at December 7, 2003 11:14 AM

In Kent's book on TDD, he contrasts the seven or so tests for the "triangle problem" using test-driven-development with the 13 or more "test-after" tests developed by Robert Binder in his book on OO Testing for the same problem.

Not a line of code was written without a test driving the creation of that line of code, but the number of tests is reduced by (1) not testing OTHER code [like how SmallInteger handles overflow] and (2) taking advantage of "white-box" knowledge after the first few tests have shaped the code.

» Posted by: keith ray at December 7, 2003 12:20 PM

Keith: are you talking about Kent's Book "Test Driven Development: By Example"? I'll pick up this book for xmas.

» Posted by: Ryan at December 9, 2003 08:26 AM

I have TDD : By Example. Let me know if you wanna give it a read-through first before picking it up..

I liked it, but it's not really the kind of thing you read more than once.. The first half is basically the money example drawn out REALLY long, and the second half is mostly just brief testing patterns (The Patterns section was one of the main reasons I bought the book and honestly, I was quite disappointed with it (the Patterns section, not the book in general)..)

» Posted by: peter at December 9, 2003 10:54 PM
Google
 
Search scope: Web ryanlowe.ca