×

Search anything:

Boy Scout Rule

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

In this article at OpenGenus, we will learn about Boy Scout Rule and why its application is vital for effective technical debt management.

As a code base grows over time, the quality of the underlying source code of a system tends to degrade, accumulating technical debt. The Boy Scout Rule in the coding world, "Always leave the code better than you found it" could largely decrease the technical debt. It's that simple, but why do many engineers don't do it?

Table of contents:

  1. Boy Scout Rule
  2. What does Boy Scout Rule do in the software world?
  3. The Dilemma
  4. The Vicious Cycle
  5. The Domino Effect
  6. Strategy to apply for Boy Scout Rule
  7. Tools to fight Technical Debt
  8. Benefits of Continuous Technical Debt Management

Boy Scout Rule

When it comes to camping, Boy Scouts have a rule - you should leave the campground cleaner than you found it. It doesn't mean the boy scouts need to clean up the entire campground. But they make sure the spot they use is cleaner when they leave than it was when they arrived.

1-Background-Camping

What does Boy Scout Rule do in the software world?

Robert C. Martin (Uncle Bob) applied this rule to software engineering: 'Always leave the code better than you found it.' The rule is considered a cure for technical debt. Basically, it means software engineers should continuously clean up small technical debt. It avoids undertaking a giant refactoring project when it is too close to technical bankruptcy.

The Dilemma

What gets in the way of the boy-scout rule?

In business world, if a company ships a new feature slower than its competitors, it might lose market advantages. Thus, business pressure force software engineers to focus on short-term outcomes by writing code that might not be as clean and high-qualities as a software engineer prefers. Over time, the source code of a software system tends to degrade. This creates future productivity bottlenecks - technical debt.

There is a constant battle between developing new features and improving the design of the code base. A software engineer team needs to find a balance between how much time to invest in shipping out a new feature in a timely manner while keeping the code clean.

One approach for software engineers to maintain quality code is to stop working on any value-added tasks, and only focus on cleaning up the code base for a week to a month. However, an alternative approach suggested by the Boy Scout Rule is to simply leave the code a little better than you found it with each commit. Through accumulation of these small improvements, the quality of the code base will be improved.

The Vicious Cycle

As the underlying source code of a system grows, so is its complexity. Inevitably, its technical debt also grows. In addition, higher complexity means lower predictability. So with a more complex code base and accumulated technical debt, it takes an engineer team more time to modify the system.

If the team spend more time on fixing the debt, value-added features might go into production delayed. Or the team could simply choose to skip the fix causing more debt to pile up. Now, a vicious cycle is formed.

Vicious_Cycle

When the vicious cycle is formed, operations in all departments in an organization are affected. They need to deal with the meta-problems caused by the technical debt. Time is money. The delay of product shipment could cost a fortune.

The Domino Effect

Here we will talk about how technical debt affects all departments of any software business.

Domino_Effect

  • Product Management Team

Product management aims to deliver value to customers and the business. So besides planning time for product development, product managers need to allocate a reasonable budget for technical debt in every sprint. It allow engineers to pay back the debt as they ship new features.

  • Sales Team

Salespeople win deals by competing on features. Focusing on developing more features means less time to fix technical debt. They need to understand accumulation of technical debts will slow down the shipping process eventually.

  • Marketing Team

Marketing needs product and feature release dates, which means clear predictability. As mentioned earlier, unmanaged technical debt decreases predictability.

  • Finance Team

Engineers spend in average one-third of their time dealing with technical debt. It means one-third of your engineering team's salary goes to fixing poor-quality code base. Imagine technical debts also affect other departments. It could cost millions of dollars a year.

Strategy to apply for Boy Scout Rule

Effective technical debt management is crucial. Nevertheless, there are concerns a software engineer team might have when they try to be boy scouts. They include over-cleaning that delay the shipment, and not doing enough cleaning due to time constraint.

Here are strategic steps you can take to apply for Boy Scout Rule:

  1. Fix quickly if you see a small technical debt.

  2. Report an issue in a tracking system if it might take time to fix.

  3. Continuously tracking big technical debt. Make them high priority items to work on in your sprint.

Tools to fight Technical Debt

Based on Gartner, Inc. is an American technological research and consulting firm, teams with a good strategy to actively manage and reduce technical debt will achieve at least 50% faster service delivery times to the business.

There are 3 main types of tools for managing technical debt:

1. Project Management Tools

Project Management Tools like Jira and Confluence are designed for collaboration between cross-functional teams. This allows project managers or product owners to manage issues logged by software engineers.

2. Static Analysis Tools

Static Analysis Tools uses quantitative data to analyze source code. They help developers identify and fix issues early, improve code quality, spot security vulnerabilities, and ensure compliance, etc. Static Analysis Tools such as SonarQube and Semmle are used for such purposes.

3. Technical Debt Tools

The drawback of using Project Management Tools like Jira is that it's separate from your code IDE editor. Utilizing Technical Debt Tools like Stepwise allows a software developer to streamline the process of creating, viewing and resolving issues directly from the IDE besides visualizing tech debt in your code base. Besides the integration with Jira allows for prioritizing issues and tech debt, and planing sprints.

Benefits of Continuous Technical Debt Management

If we apply Boy Scout Rule consistently and properly, technical debt will be largely improved. Quality code base not only speeds up the work process of a software engineering department, but also affect the efficiency of other departments in an organization. After-all, all departments are inter-connected like a web that works together to form a body of an organization.

Boy Scout Rule
Share this