Project

General

Profile

CodingRules » History » Revision 6

Revision 5 (Jules Waldhart, 2016-05-30 16:55) → Revision 6/7 (Jules Waldhart, 2016-05-31 13:45)

h1. Coding Rules 

 *Table of Contents* 

 {{toc}} 

 An unordered list of stuff we would like devs to follow 

 h2. Naming 

 h3. Classes, attributes, variables 

 * ClassesAreCamelCase with first letter capital, also are all types (typedef, enum, struct,...) 
 * methodsAreCamelCase with first letter lowercase 
 * _privateAttributeStartWithUnderscore _attributeStartWithUnderscore and is camelCase camelcase 
 * localVariable or local_variable, first letter lowercase 
 * avoid calling @a=function(1.0,6,false,true)@, declare local variables with descriptive name for the parameters: @a=function(step_size,iteration_nb,enable_XYZ,multi_thread)@ 

 h3. Enums 

 Put enums in an existing namespace or class, and/or *create a struct and put it inside*. 
 That struct can also contain methods to convert to/from string and other types. 
 Enums and their container struct are CapitalCamelCase, as their values (see example). 

 Google coding style recommends using @MACRO_STYLE@ for enum values, or constant style, ie. starting with a "@k@": @kRobot@. It can be accepted, stay consistent within a "module"/class of move3d. 

 <pre> 
 struct RobotType{ 
    enum Value {Robot, Human, Object, NotDefined}; 
    std::string toString(Value v); 
    ... 
 } 
 </pre> 



 

 h2. Unimplemented stuff 

 * not implemented functions: put an @assert(false);@ in it, it will abort in debug mode, and do nothing in release. (instead of a print or whatever, which is totally unclear) 
 * but mainly, avoid to commit unimplemented functions.