Andrew's Digital Garden

The Boy Scout Rule

Leave the code cleaner than you found it.

This is also related to the 'Broken Windows Theory'. A broken window that is not repaired will leave the impression of negligence. Over time this can compound, and a broken window turns into an abandoned building.

Enact the Boy Scout Rule instead. When you're in the area of the broken window, fix it. Abstract a function, improve a type, make the code cleaner and better.

Also known as the 'Campground rule', among other names

[[concepts]] [[principles]]

The Boy Scout Rule