The boy scout rule: clean up a codebase without a big rewrite
Good practices and conventions on a codebase always evolve over time. And even when things look stable, there are often updates to deal with.
A nice rule to gradually get everything back in line, without a big bang rewrite: the boy scout rule.
The idea
Leave the place cleaner than you found it.
Concretely, when you touch an old file for some feature, you also take the chance to put in place the latest conventions the team has decided on.
Little by little, everything gets back in shape
Between these touched-up files, the new files created the right way from the start, and the old files that get deleted over time… little by little, everything ends up in good shape everywhere.
It’s remarkably effective: I’ve put it into practice, with results I’ve seen on several large codebases.
It’s the same reflex a Harness Engineer applies to technical debt: deal with it as you go, rather than in a dedicated cleanup project.
Happy coding!