Tips_namingconventions   >   Naming Conventions

Naming Conventions

Naming conventions are extremely important. If you are writing code on your own you might not fully appreciate the importance of using consistent naming conventions. The minute you add a 2nd or 3rd developer to a project you realize how important it is to establish and use consistent naming conventions. Using consistent naming conventions also makes it easier when you go back to maintain or enhance code a year or two later.

I recommend you to pick up a copy of the book, Code Complete - A Practical Handbook of Software Construction, written by Steve McConnell. It is probably one of the best books on good programming practices. Chapter 9 - The Power of Data Names, is full of great advice on choosing good names. The following is some of the advice by Steve McConnell.

Studies have shown that the optimum variable name is between 8-20 characters in length.

Too long: NumberOfPeopleOnTheUSOlympicTeam

Too short: N, NP, NTM

Just right: NumTeamMembers

If you pick good names for your libraries, classes, methods, and variables you will make your code much more readable and easier to maintain. Changing names after the fact is difficult because you run the risk of breaking code that referenced the library, class, method, or variable. Think long and hard about names and be consistent.

This section explains the naming conventions used in StudioTips.