The Boy Scout Rule of Engineering

Like many others out there, I am an Eagle Scout.  One of the mantra’s that the Boy Scouts of America organization has is to “Leave something better then when you arrived.”  If you were camping, this meant that you leave the campsite cleaner then when you arrived.

I have vivid memories of me and my fellow boy scouts lining up in a long line and “sweeping” the campgrounds after our stay to pick up trash.  We were never able to completely “redo” the campsite or fix every single problem it had – but we always left it better then when we arrived.

The same applies for code.  When you brush over a piece of code, you should always leave it better then when you arrived.  It really is easy to be in the habit of fixing small pieces of code that only takes you a few minutes.  In my opinion this is a valuable tool to fight the Tech Debt monster and to keep it under control.

Don’t read this the wrong way.  Often I see engineers get stuck in the trap of fixing one thing, then another, then another – until they are 10 layers deep in a refactor that consumes all their free time.  Avoid this.  Just fix small pieces at a time using whatever time you have.  Make notes if needed and then the next time you stop by take another piece of the pie.

This is more of a habit to be in – rather then a one time quest.  Be in the habit of always making code better when you come across it – and soon you will find that your code is actually quite beautiful.

Comments

comments

Posted in .