Naming Conventions for Programming

by Dale M.A. Johnson

 

created 3/28/06

last updated 4/21/06

 

The absolute best thing about programming has always been deciding on names to use for variables... NOT! In any case, in order to maintain consistant code, the following naming conventions are to be used:

 

Basic Naming

When working on Fire Emblem Factory, do not use underscores, and use names with a capital letter at the beginning of each word (except for the first word). If a word would normally be in all caps (for example, how many people write EXP), it *can* be left uppercase, but it is preferred that you follow the first-letter-upper-case-all-others-lower-case standard. Here are valid names:

 

 

Classes and Functions

Class names always being a capital C. Thus you would have CMapDisplay or CStealExp. Class objects should generally remain in all lower case (so that they don't get confused with data structures). Functions within classes don't neccisarily need any special naming conventions, so long as they follow basic naming standards (although they may start with a capital letter if they are part of a class).

 

Local (and private) function names should always end with an underscore. For example, exampleYouCantSeeMe_()

altered 4/21/06

 

Variables

Variable names are to be preceded by a lower case letter denoting its type.

 

 

Globals

Global variables that are directly related to the engine on the "system level" (how the engine is to handle graphics and sound, etc.) are to be prefixed with sys_ in addition to their lower case vaiable type indicator. For example, sys_iScreenHieght. All other global variable simply need to begin with a "g": giGlobalInteger, gbGlobalBoolean, gtEtc.

added 4/21/06

 

Structures

When declaring a structure, the structure itself should be preceded with "st" in lower case letters, for example: typedef struct stStructure. The identifier sould be preceded by "make," so it would be makeStructure. All structure objects are to begin with an "s," following variable naming standards. Thus, you would end up with something like this:

 

typedef struct stCharacter {

     string tName;

     bool bAteTooMuch;

} makeCharacter;

 

makeCharacter sMarcus;

makeCharacter sLowen;