Boy Scout Rule is good but not enough

Ürgo Ringo
Jun 22, 2015 · 2 min read

One widely used idea when dealing with legacy systems is the Boy Scout Rule. It offers good incremental strategy for improving codebase. I find it to be very valuable guideline which is much more practical than creating separate refactoring stories/backlogs.

However, I think that if we strictly follow this rule then often it is not enough to stop entropy from increasing. If we don’t think about the high level picture while making something look better locally then we may improve something in one place but at the whole system level situation may not improve much or may even get worse.

For example, lets say that our data access details are exposed to our business logic (e.g using Spring JdbcTemplates inside business services or HQL queries inside Entities). We change this in one place by introducing a Repository. Yes, we have improved that particular place because now we can test business logic with mocked data access but at the same time we have now introduced an exception in the design of our system. If we are not adamant in following this new approach then system will still corrode and perhaps even faster as there are now multiple ways of solving the same problem.

But how to make sure that when we introduce some small increment towards new (better) direction we will keep adding to it over time? Should we perhaps write it down to some refactoring backlog :)? I think if we have good team then this is naturally kept in the team’s collective memory. Of course any long term incremental improvement only works if we have stable code ownership and team actually feels its long term responsibility. This is why code written by large group of people (exceeding efficient team size) with shared code ownership typically doesn’t get better no matter how many good boy scouts there are.

So Boy Scout Rule is good approach but often we need to look at local cleanup in the bigger picture and see it as small increment towards some long term direction.

Originally published at on June 22, 2015.

Wise Engineering

Posts from the @Wise Engineering Team

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store