Sponsors
Documentation
    Simulator
    Standards
    Team
    Kludges
    Tools
    Unix
    Versioning
    MRB2000
    Tsinghuaeolus
Downloads
Members Only
About Us

Home > Documentation > Standards

Variable Naming

Variables are named using Hungarian Notation.  In Hungarian Notation, the first few letters of a variable's name describes it's type.  This notation is useful while debugging because a programmer does not need to look at a variable's declaration to know the variable's type.  We have tried to make the prefixes compatible with common Hungarian Notation and as intuitive as possible. 
WARNING: incomplete table.

TypePrefix
boolf
characterc
byteb
unsigned valueu
integeri
stringsz
pointerp
WorldModelwm
Behaviorbe
Bodybo
Anglea
Actionac
Vectorv
Gradeg
floatr
doubled
SensorDatasd
IdentityDataid
Recommendationrec

Some constants are defined in constants.h using the #define preprocessor directive. However, modifications of constants.h cause the entire project to recompile; now, we are trying to make constants static constant members of the classes that need them. Name constants in all uppercase with underscores such as: MAX_SPEED.

File names

All file and directory names should be lower case (preferably without underscores).  Source files should end in .cpp and header files should end in .h.

Directory Structure

The directory structure of the robocup source files is consistent with the default settings of KDevelop v2.0.
DirectoryContents
/uvarobocupconfigure and automake Scripts as well as README and TODO docs
/uvarobocup/uvarobocuptop level source directory, holds main and mastercontrol
/uvarobocup/uvarobocup/bodyactions
/uvarobocup/uvarobocup/modulesbehavior and perception modules
/uvarbocoup/uvarobocup/sensorsensordatas
/uvarobocup/uvarobocup/worldmodelWorldModel and the objects it contains
/uvarobocup/uvarobocup/commUDP/IP communication classes
/uvarobocup/uvarobocup/commonclasses needed by many objects such as constants, angle, and vector

Functions

Function names should start lowercase and then become uppercase.  Function parameters have a preceding underscore (this may change in the future).  The curly braces are on the line after the function prototype.
Example:
void WorldModel::setTeamName(string _szName)
{
    szName = _szName;
}

Classes

Class names should start uppercase and stay uppercase for every additional world. Class members follow the Hungarian notation.
Example: WorldModel

Commenting

Try to keep comments to a minimum by coding as clearly as possible using descriptivComment using the // style unless you are temporarily commenting out a block of code during debugging.  To indicate code segments that need modification use:
//@todo: <todo instructions>

To indicate code segments that might be dangerous (and therefore will probably need to be changed in the future) use:
//@warning: <warning information>

To indicate code segments that are "kludgey" use:
//@kludge: <information about the kludge>

But, of course, no one will ever use this comment :).

 
©2002 University of Virginia Deparment of Computer Science
Have questions? Email David Evans