Campsite Rule

Also known as the “Scout Rule,” the Campsite Rule is based on the Scouting America principle: “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.

This principle also applies to code: if you encounter messy or problematic code, clean it up regardless of who might have written it.

Rationale

This avoids the need for large-scale refactoring or clean-up, by making small improvements often.

It also relates to another principle of “Broken Windows.” This principle comes from an analogy of neighbourhoods where windows are left broken in vacant housing. If they are fixed quickly then more windows are less likely to be broken.

Applying the principle

  • Refactor as you go: make small and safe refactoring a habit during development work.
  • Fix small defects: address minor bugs as you encounter them instead of deferring until later.
  • Improve documentation: update documentation as you come across outdated or unclear information.

Ultimately, the Campsite Rule is not about perfection; it is about constant, positive evolution.

References