November 20, 2009, Newsletter Issue #78: Standards

Tip of the Week

When starting a new project (or jumping into an existing project) define a set of standards for function and variable names. This may sounds simple and maybe even irrelevant, but creating a document defining these standards will go a long way towards code management and maintenence. For example, if you prefix every variable or function/sub call with the type of call and the return value (or variable type), use case-consistency, and name functions/variables properly, you only need to glance at a function name or variable name to know what the return value is, whether it's a function, sub or variable, and what it does. Here's an example of a FUNCTION that returns a STRING value of a person's username: fnStrGetUserName(). Here's an example of a global variable, that is a long number, and holds a value of a calculation of a circle: gvLngCircleValue. Pretty self-explanatory. AND somewhat self-documenting. The more readable your code, the less comments you need, the less chance someone might misuse the variable or function (and throw an error), and the better chance someone ELSE will be able to read your code.

About LifeTips

Now one of the top on-line publishers in the world, LifeTips offers tips to millions of monthly visitors. Our mission mission is to make your life smarter, better, faster and wiser. Expert writers earn dough for what they know. And exclusive sponsors in each niche topic help us make-it-all happen.

Not finding the advice and tips you need on this Web Development Tip Site? Request a Tip Now!


Guru Spotlight
Jennifer Mathes, Ph.D.