Chapter 8. The Boy Scout Rule
THE BOY SCOUTS HAVE A RULE: âAlways leave the campground cleaner than you found it.â If you find a mess on the ground, you clean it up regardless of who might have made it. You intentionally improve the environment for the next group of campers. (Actually, the original form of that rule, written by Robert Stephenson Smyth Baden-Powell, the father of scouting, was âTry and leave this world a little better than you found it.â)
What if we followed a similar rule in our code: âAlways check a module in cleaner than when you checked it outâ? Regardless of who the original author was, what if we always made some effort, no matter how small, to improve the module? What would be the result?
I think if we all followed that simple rule, we would see the end of the relentless deterioration of our software systems. Instead, our systems would gradually get better and better as they evolved. We would also see teams caring for the system as a whole, rather than just individuals caring for their own small part.
I donât think this rule is too much to ask. You donât have to make every module perfect before you check it in. You simply have to make it a little bit better than when you checked it out. Of course, this means that any code you add to a module must be clean. It also means that you clean up at least one other thing before ...
Get 97 Things Every Programmer Should Know now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.