Hello World: 2.3 Hello World: Naming Conventions

Up: GEOS SDK TechDocs | Up | Prev: 2.2 Strategy and Internals | Next: 3 Geode Parameters File

You might have noticed some of the names of variables, messages, and routines and seen a pattern of naming. Geoworks has developed a few naming conventions for various different items in the system. You don't have to follow these conventions, of course; it may help, however, if you keep to our conventions until you're familiar with most of the system. Some of the items that have special naming conventions are

Variables
Typically, variables begin with a lower case letter and have each subword in the name capitalized. The variable helloTextColor is a good example. Variables with just one word in the name are all lower case.
Classes
Class names should always have the suffix Class . Typically, the first portion of a class' name will describe the particular application, library, or module it is associated with. The second portion of the name should reflect the class' superclass. Each portion of the class name should be capitalized. Thus, HelloProcessClass conforms because it begins with the application's name (Hello), then has the superclass' name (Process), and finally has the suffix Class.
Constants
Constants are typically all upper case with underscores to delineate the portions of the name. C_BLUE is a good example; it is a set value that does not change. The structure of the name should reflect the use of the constant. (In this case, the enumerated type Color is reflected in the C_ portion of the constant's name.)
Routines
Kernel and UI routines, as well as method names, should have each portion capitalized. They should begin with some abbreviation relating to the module they belong to. For example, GrCreateState() is a graphics system routine, as is GrInvalRect() .
Messages
Message names should be all uppercase and begin with MSG_. Each portion of the name should be separated with underscores, and the first portion after MSG_ should reflect the class in which the message is defined. For example, MSG_HELLO_CHANGE_TO_BLUE follows all these conventions.
Objects
Object names are typically capitalized in the same manner as routines and classes. The object's name should reflect both the object's module and its class (or its function if not its class). HelloView is a good example.
Instance Data
Instance data fields typically have as their first portion an all-caps acronym for the class name with an I tacked on for "instance." The second portion is like a variable name, and the two portions are separated by an underscore. For example, GI_visMoniker is a field of GenClass (hence the GI_ ), and visMoniker is the variable name of the field.

Up: GEOS SDK TechDocs | Up | Prev: 2.2 Strategy and Internals | Next: 3 Geode Parameters File