Follow the campsite rule.

Leave it better than when you found it.

When you go camping, you bring a lot of stuff with you and make a mess. Being a considerate person, you clean up after yourself before leaving. To be a truly nice person, you then clean up a little more, leaving the campsite in a better condition than when you found it.

The same should apply to developing code.

As you visit a section of code to add your feature or deal with a bug, try to make the code more DRY by refactoring out any duplicated code segments. Also, see if you can apply the SOLID principles to some of the classes under your review.

Alternately, maybe your improvement is as simple as refactoring more substantial methods and classes down to smaller ones, extracting out logic and responsibilities.

Maybe your change will merely add more or better tests. An improvement to a codebase’s tests can be a huge help.

Another way to improve things is to make the code more understandable. This may mean writing more relevant documentation, including explanations of the reasons behind the logic. Or it may mean changing the names of local variables to be more descriptive.

You don’t need to do all of these things. But anything you can do that’s a little extra, above satisfying the current requirement, will reduce the burden on others in the future.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: