The Boy Scout Rule – “LEAVE THE CAMP GROUND CLEANER THAN YOU FOUND IT”.

“LEAVE THE CAMP GROUND CLEANER THAN YOU FOUND IT”.

We all write code, but very few write good code. When I say good code it is well structured, well designed, and well commented. Looking at the code any other developer should able to know what the code is all about and how it works.

Important aspect of coding is, it should be maintainable over a period of time, to maintain the code it has to be kept clean and written well.

Good developer should always have this in mind that they should make the code better than what they started with. So that it will not rot and get degraded as time passes. I say a Developer is Good, if he takes active role in preventing the rooting or what you call degradation of code.

Boy Scout, an American has a simple rule to be followed by all profession – “LEAVE THE CAMP GROUND CLEANER THAN YOU FOUND IT”.

If every developer checked-in the code a bit cleaner than what he checked out, the code will be in much better shape and will not rot too.

Many software developers think refactoring the code as a tough task. But in reality it’s not the case, as the developer think of HUGE changes, as a result the task look difficult. More than the change the testing effort and the fear of breaking the working flow hold back many developer, from going for code refactoring.

Scout suggests, as a developer start the cleanup activity with small deeds, meaning small piece of better coding practice or a tip can be taken and changed across the code base – Meaning your code clean up need not be a big activity. Make sure this small change do not break your functionality/application and go ahead and change it across the code base. This is how you start doing small deeds.

To do this learn at least one coding tip and implement it in your project – As this will allow you to LEARN and also to IMPLEMENT along with the cleanup activity.

For example: So better start with good coding standards, as this small change will not yield in breaking of existing flows,  as you will be just renaming the variable to a sensible and understandable naming format. This is the smallest deed that you gave your project, in making it a better than what it was earlier.

As a developer one other thing you can start next is, break up one function that’s a little too large, eliminate one small bit of duplication, clean up one composite if statement and many as you confidence grows.

Try and leave this world a little better than you found it.

So did you get to know what Clean Code is? So start this small deed and Try and leave this world a little better than you found it.  And try imagining the world after a considerable amount of time, you will start seeing a better world and also makes you proud for making it a better. All these small deed and effort makes you ready for next roles and a mature as a good developer.

In deed code refactoring is continuous and incremental effort, without an end, as we can make every bit of piece a better way than it was.

Can you imagine working on a project where the code simply got better as time passed?  Please let us know your thoughts by commenting your views.

Related Articles:

97 Things Every Programmer Should Know

 

Add comment