top of page
  • Writer's pictureMatt Burrell

Beware The Boy Scout Rule

Updated: Dec 14, 2022

I’m a big fan of rules of thumb in software development.

They help us understand and apply good principles of software design.

Here are a few useful ones:

  • Keep it simple, stupid

  • You ain’t gonna need it

  • Don’t repeat yourself

  • Tell, don’t ask

  • Don’t polish a turd

Ok, I added the last one myself…

The rule of thumb that concerns me, however, is the so-called ‘Boy Scout Rule’:

“Always leave your code better than you found it”

This is dangerous advice because “better” is a subjective term. Let’s assume by better we mean cleaner. All developers have read Clean Code, right?

The trouble arises when developers apply clean code rules without using their common sense.

In their effort to leave code better than they found it (refactoring), I find that some developers, despite their good intentions, leave the codebase in a much messier state.

This happens because they end up writing a lot more code.

This usually violates some or more of the other principles, e.g. Keep it simple, stupid, You ain’t gonna need it and, of course, Don’t polish a turd.

Happy coding.

Recent Posts

See All

Why You Should Hire Product-Focussed Developers

You may be used to thinking of developers primarily in terms of their technical skills. But not all developers are solely focused on the technical aspects of their work. Many developers got into progr

Debunking Monorepo Myths

A monorepo is a version control strategy where multiple projects are stored in a single repository. I've noticed that some developers have a negative perception of monorepos due to past struggles with

Bình luận

bottom of page