Pro EP 92 : What is Boy Scout Rule ?

Muhammad Waseem
Become .NET Pro !
1 min readDec 1, 2023

--

Have you heard about Boy Scout Rule ?

I am sure that you would have implemented it many times before.

Let’s see what exactly it says :
- Always leave the code cleaner than you found it
- Encourages continuous improvement in the codebase

Key points are :
- Make small improvements while working on code.
- Focus on readability, maintainability, and efficiency.
- Aligns with principles of code quality and continuous improvement

These are the examples where you can see this rule in action :

1/ If you see vague variable names while fixing a bug, rename them to improve clarity for the next developer. For example if there is a variable named list and you know it is student marks list then
why not renamed it to studentMarksList

2/ If you notice unclear or outdated comments, take a moment to update them, ensuring they provide accurate information.

3/ When touching a module, remove any redundant code, keeping the file clean and focused on what’s necessary.

Whenever you’re ready, there are 4 ways I can help you

  1. Subscribe to my Weekly .NET Newsletter of C#/.NET with 6000+ Software Engineers.
  2. Promote yourself to 7500+ subscribers by Sponsoring my Newsletter
  3. Download my eBook at Gum Road which contains 30+ .NET Tips (With 2800+ Downloads)
  4. To get 100+ free and paid resources for learning C# and .NET visit this GitHub Repository

--

--