Code Guidelines
This is a list of things to follow. This is by no means a complete list of things that you should do when coding, but just be nice when writing your code.
Keep in mind, failure to comply with these guidelines will result in your changes being removed from the repository. Project Documentation is VERY important.
- Camel Caps for all variables/methods/functions. Classes/Structs should start with a capital. Variables/methods/functions should start with a lower case.
unsigned int mySuperAwesomeVariable; unsigned int someAwesomeFunction; class SuperAwesomeClass { ... }; - Constants/#define constants/#define macros should be written in all caps with '_' separating words
#define MY_SUPER_AWESOME_DEFINE 42 const unsigned int MY_SUPER_CONSTANT = 42;
- Increase indention level at every new block
unsigned int myFunction() { for(unsigned int i = 0; i < 10; i++) { //something here } } - Open block '{' goes on the same line as the function/while/for (as done above).
- Close block '}' goes on a line alone (as above).
Commenting
We will be using doxygen to keep all of the documentation in order. There will be more on this later. ALL CODE WRITTEN AND COMMITTED MUST BE DOCUMENTED The following file gives a good example of how to document any and everything that you might need to.
//! A test class. /*! A more elaborate class description. */ class Test { public: //! An enum. /*! More detailed enum description. */ enum TEnum { TVal1, /*!< Enum value TVal1. */ TVal2, /*!< Enum value TVal2. */ TVal3 /*!< Enum value TVal3. */ } //! Enum pointer. /*! Details. */ *enumPtr, //! Enum variable. /*! Details. */ enumVar; //! A constructor. /*! A more elaborate description of the constructor. */ Test(); //! A destructor. /*! A more elaborate description of the destructor. */ ~Test(); //! A normal member taking two arguments and returning an integer value. /*! \param a an integer argument. \param s a constant character pointer. \return The test results \sa Test(), ~Test(), testMeToo() and publicVar() */ int testMe(int a,const char *s); //! A pure virtual member. /*! \sa testMe() \param c1 the first argument. \param c2 the second argument. */ virtual void testMeToo(char c1,char c2) = 0; //! A public variable. /*! Details. */ int publicVar; //! A function variable. /*! Details. */ int (*handler)(int a,int b); };
This will output this: http://beaversource.oregonstate.edu/projects/osurcmarsrover/attachment/wiki/SoftwareTeamRequirements/refman.pdf?format=raw
SVN
All of your code should be committed through SVN. This means you should learn how to use it well. Also ALL CODE COMMITTED MUST BE IN A COMPILABLE STATE. Always compile and remove compile bugs before committing. This prevents slowing down the whole team.
Attachments
- refman.pdf (98.9 kB) -
Example documentation pdf
, added by goskab on 12/09/08 21:16:38.
