Friday, April 14, 2006

Tests, Blogs, and Understanding

I'm still thinking about test writing and how it helps us understand our code better. Then I noticed Laurent Bossavit's blog entry about code (and bug) ownership. Two paragraphs really struck me.

Joe says he gets it, and writes a new test which shows he does indeed get it. We fix the problem and check in the fix.

Then we get to the important point. "Think you'll remember this? You've been bitten once, so maybe it'll stick..." But Joe wants to make sure: "I've got it now, but I feel like it could slip away. What I'll do is write a blog entry sometime this afternoon - if I can explain it to someone else I'll feel confident I won't get bitten again. And I'm sure there'll be someone to straighten me out if I only think I understand."

I think there's a lot of wisdom there. When we're writing or reading code, we might think we understand what's going on inside it. When we write a test, it's more likely that we do. When we explain it to someone (or blog about it) we're most likely to understand and remember.

I think this is one reason that both Sean and I are blogging about the things we see and do while we work on checkr.

No comments: