Model: Boy Scout Rule

May 24th, 2018

Leave the campsite cleaner that you found it.

 

The spirit of this rule can be applied in many areas.

 

In programming, you can adapt it to how you treat code.

When making changes in code:

 

If you leave a mess behind,

the entire codebase will end up one big unmaintainable mess.

 

If you leave it behind as good/bad as it was,

your code base will still end up as a mess.

It will probably take longer and be less of a mess.

How is this possible?

Are you the only one working on the code?

Is there ever a moment when you will want/need to take a shortcut?

Will you ever forget something you did 'temporarily'?

And of course code inflation in general.

 

If you leave behind code better than it was,

your codebase will improve.

Marginal gains compounded over time.

 

If you leave behind perfect code or nothing,

you will end up with nothing.

 

 

(src: Book: Clean Code - Robert C. Martin)