Ten Minutes Without a Test

Looks like today is my "find cool blog posts" day. "Uncle Bob" Martin has a fantastic blog entry about what happened when he tried to refactor in a big chunk rather than doing it incrementally. I won't tell you what happened. Read it yourself.

(Go on, read it!)

I can't tell you how many times this exact thing has happened to me. I know an incremental approach is faster. It just feels slow. And yet, when faced with a "simple" refactoring with broad ramifications, like changing a type, I often do it anyway. Once I did this while leading a refactoring workshop and spent 30 minutes screwing up in public. Doh. On the other hand, it was a great demonstration of what not to do. (I often do unrehearsed workshops, taking code or requirements from the audience. It lets people see how things work in messy reality, but it's not for the faint of heart!)

There's something about these architectural refactorings that causes it. I do things very incrementally otherwise. But when I start these kinds of changes, I let loose my inner pig and waste all kinds of time. I think I do it because every so often, it works, and I get to tell myself, "self, you're a genius!"

This is why pair partners are so important. They shove that inner pig back in its sty. It's good to have a pair partner who's not afraid to tell you when you're being an idiot.

(By the way, Uncle Bob is a terrific writer and a great speaker. At a conference several years ago, he gave this incoherent dinner speech about a prince, and a frog, or something. I can't remember. It made no sense and had no point. He stopped just when I thought I recognized a plot. But it was the most entertaining speech I've ever heard.)

If you liked this entry, check out my best writing and presentations, and consider subscribing to updates by email or RSS.