The boyscout rule is a simple rule that can be applied to many commons. It says: “Leave the campground cleaner than you found it”. It’s probably the best way to keep a common space clean and tidy. It’s also a great way to control technical debt in a software project.
Beawiharta Beawiharta/Reuters
It breaks down to a simple principle: if you see something that is not right, fix it. If you see a piece of code that is not up to par, refactor it. If documentation is outdated, update it. If a comment is confusing, improve it or remove it. If a tool or process should be improved, do it or if it leads to a rabbit hole, open a ticket.
Adopting the rule is not easy. It requires a change in the culture; instead of moving fast and breaking things you should do things right and keep the project clean. As a first step, leadership should acknowledge that the debt is there and that cleaning takes time. This will let code reviewers and developers follow the boyscout rule and take the time to clean the code.
Encouraging the rule will instill a sense of ownership and responsibility in the team. It will shift their PoV to that of an engineer and technical debt will start hurting their eyes. Keeping a clean, sharp code and infrastructure will become a habit. New debt accumulation will slow down and code quality will improve.