The Boy Scout Rule

One of the software development principles I live by is the "Boy Scout Rule".

The Boy Scouts of America have a simple rule that we can apply to our profession.
Leave the campground cleaner than you found it.
If we all checked-in our code a little cleaner than when we checked it out, the code simply could not rot.

Whenever I dig around in my company's rather large codebase hunting down a bug or perhaps adding a feature, I look for little opportunities to leave the files I touch a little cleaner than I found them. Ancient commented-out sections of code, unused variables, unused methods, and other detritus left behind by the organic change of a codebase are all ripe targets. ReSharper is the poker stick with which I pick up the litter around my campsite.

It's my little way of fighting back against the tendency of a codebase to decay and become noisy over time. And, not to mention, there's just something fun about deleting code. I encourage everyone to experience the joy of deletion.

0 comments :