Standards

Read this tip to make your life smarter, better, faster and wiser. LifeTips is the place to go when you need to know about Web Design and Development Tips and other Web Development topics.

How can I improve code readability.

Standards

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.

   

Comments

Nobody has commented on this tip yet. Be the first.



Name:


URL: (optional)


Comment:


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


Guru Spotlight
Sherril Steele-Carlin