Home
Documentation
    Simulator
    Standards
    Team
    Kludges
    Tools
    
CVS
    Unix
    Versioning
Downloads
Members Only
About Us

Home > Documentation > Standards

Variable Naming

Variables are named using a convention similar to the one described by Scott Meyers in Effective C++.  Variables are written in camel case (i.e. variableName). Member variables are differentiated from local variables and function parameters by a trailing underscore (i.e. variableName_). Previously the code was written using Hungarian Notation. Hungarian Notation is a naming convention where the first few letters of a variable's name indicate the type of that variable. If you are working in a code segment that used this naming scheme, please take the time to rename some of the variables with the new standard.

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
/uvarobocup/libTexternal libraries used by the player and tests.
/uvarobocup/includethe header files for external libraries. objects such as constants, angle, and vector
/uvarobocup/testsunit tests for the classes in /uvarobocup/uvarobocup

Functions

Function names should start lowercase and then become uppercase (camel case).  The curly braces are on the line after the function prototype.
Example:
void WorldModel::setTeamName(string name)
{
    name_ = name;
}

Classes

Class names should start uppercase and stay uppercase for every additional world. Class members follow the camel case, trailing underscore notation.
Example: WorldModel

Commenting

Try to keep comments to a minimum by coding as clearly as possible. Comment 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