Sunday, August 5, 2007

Unit Test Analogies

Alex Miller has a recent post about an interesting analogy for unit tests.

This weekend, I remembered this gem. I did not come up with this quote. I read it somewhere years ago... If anyone can credit the source, please do so (I tried a quick Google search but no luck).

Checking code into source-control without unit-tests is like betting on a poker hand without looking at the cards. -- Anon.

4 comments:

Anonymous said...

That's a pretty dumb analogy... Even if code is checked in without tests, the odds that they would be passing these tests are infinitely higher than receiving a very good poker hand.

Go read "Leaking metaphors", by Joel Spolsky.

rhyolight said...

Dear Anonymous,

Maybe you should take heed of another Joel blog post, where he referenced anonymous comments on blogs:

"...followed by a long spew of noise, filth, and anonymous rubbish that nobody ... nobody ... would say out loud if they had to take ownership of their words..."

Anonymous said...

Fine. My name is Steven Spencer. Happy?

Are you taking me more seriously now?

Michael Easter said...

Steven,

I sense "blog entropy" but I'll give you the benefit of the doubt.

I'm a big fan of Joel S. I looked for said piece but only found "The Law of Leaky Abstractions" which concerns implementations.

I don't see how the quote really gets into odds/probabilities. The point is simply that both scenarios are much riskier than their respective alternatives.

M.E.