As a Courtesy for the Next Teammate
I have recently returned from a trip abroad, and, during the flight, I came across the following notice:
I saw this and thought about working in a team. Think of all the people on the airplane as a large group, there is a subgroup whose role, among others, is to make sure the restrooms are tidy and clean. We know them as flight-attendants or stewards. In order to ensure that everyone gets a good experience, they would need to enter the restrooms after each time it is used, and clean after the travellers.
Compared to a software development team, this would mean someone, say testers, would need to refactor and clean the code each time it is being committed, to ensure that the code is in a good-enough state for the next programmer to visit the code.
Coming back to air-planes, I have first noticed these signs many years ago. I thought they were new, but I can only guess they existed long before then. The idea is that each visitor should leave the wash basin just slightly cleaner than before he or she used it. Maybe a bit cleaner than how it was received, assuming that not all passengers read this sign. I made a short survey that revealed that there are frequent travellers that did not notice these signs, although they have used the restrooms during flight in the past.
Not surprisingly, Uncle Bob phrased his opportunistic refactoring principle based on the American Boy Scouts rule: “Always leave the campground cleaner than you found it”
So next time you visit the team’s code, as a courtesy to the next team member, may we suggest that you refactor, just enough to leave the code slightly better than how you found it.
If you’re afraid you’ll forget it, you are welcome to download and print the attached poster:
Nice thought but a clean-up of the code is a developer’s responsibility. A tester, ideally, should not even look at the code and work from the requirements.
What’s ideal for one team, may be wrong for another:
As in this example.