Friday, October 04, 2013

Accurate and Consistent Naming, the simplest yet has the most beneficial discipline in programming

I think if you have to name one discipline that is the most simple but give the most return in term of maintainability, it's probably proper naming. You can do any fancy pattern or coding practice but if you are lazy in maintaining consistent naming of variables, functions, classes, your code will soon rot and unmaintanable. Ironically, it probably the simplest practice to do, especially with powerful capabilities in todays IDE and text editor in doing search/replace and rename-refactoring.

When you don't consistently naming everything properly in your code, you'll obscure your code intention thus making the maintenance hard even for yourself, let alone others. I prefer to write code that I can forget, meaning the code that when I visit it again in the future, it will take the least effort for me to remember what it is that I intent to express with it. Ideally, looking at the naming, structure and perhaps some external notes and diagram should be enough for  us get an understanding into the code again.

There is now a lot of guideline how to do consistent and proper in naming in codes. There might also some variation of guidelines between  languages, framework, platform. Whatever standard you use, any naming guideline/standard is better than none, I guess. Do yourself, and others, a favor and properly and consistently naming things on the code.

No comments: