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 the mess. 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.”
by Robert C. Martin
Yesterday, I wrote about code comments. It’s my opinion that most code comments suck. They’re misleading, wrong, and most importantly a side effect of laziness. Comments like this:
x += 7.5 // number of hours in a working day
// For some reason there is a race condition in `updateTotal`.
// The odds of it happening twice are really low though.
Or, worst of all, this:
// TODO fix for Sundays
These comments make the code worse. Rather than fixing the root cause, the developer has chosen simply to document the problem.
Don’t be that developer. Leave this world a little better than you found it.
Follow the Boy Scout Rule.