When coaching teams, one of the problems that I often run into is how to move the team’s definition of “done” past “it works!” to a place that includes those little things like code and test cleanup. A lot of technical debt can pile up in the gap between those two places.
To motivate moving the definition, I’ve used the analogy “Leaving a Clean Campsite”. When I was a Scout, the standard procedure on breaking camp was to form a line abreast and walk through the campsite removing all traces of humans having been there, even if they were traces that we hadn’t left. If someone else left a gum wrapper, we’d clean it up. The goal was to leave the campsite a cleaner place than we’d found for the benefit of the next set of campers.
I believe in the same approach for code: Before checking in a change, make a pass through the affected files looking for refactorings and other cleanups. A bit of new code isn’t as simple as it can be? Refactor it. Someone else left a formatting problem or a typo in a comment? Clean it up. Try to leave the code a better place for your having been there. I’ve found that this incremental attention to cleanliness and detail leads to a more habitable, enjoyable code base.
The problem with the “Clean Campsite” analogy is that it doesn’t translate well to a time and place where camping isn’t part of the common shared experience. I was getting more blank looks. The message wasn’t getting across.
So earlier this week when I gave a short presentation to a team that I’d been was working with, I tried two analogies: “Leave a Clean Campsite” and “Leave a Clean Kitchen”.
The Clean Kitchen won. People who sat quietly through the campsite nodded in agreement at the kitchen. When the meeting notes came out, “clean kitchen” was what got recorded. There was no mention of some old campsite.
No surprise, really. More people have been in a kitchen than have been camping. Even if they don’t cook, they get that a clean kitchen is an easier place to start working in than a dirty one. And if they have cooked, they really get it.
So that’s is the analogy that I’ll stick with for now.