Skip to content

Programming rules

BorjaFG edited this page Mar 22, 2017 · 6 revisions

Programming style

C++ code

  • Braces go in a new line, unless the content is so small that it's not worth the extra line. In any case, if the opening brace is in the same line as the instruction (for, if...), the closing one should too be in the same line.
  • Member variables are prefixed "m_", and pointers are appended "m_p" or "p" (depending whether they are a class member variable or not).
  • Class names start with a capital C and each word within the name is capitalized: CTimeLine, CGaussianNoise, ...

C# code

  • Braces go in a new line, unless the content is so small that it's not worth the extra line. In the case of properties, because they can have very little code and a lot of braces, it is acceptable to make exceptions if readability is improved.
  • Private variables not exposed to other classes are appended "m_", whereas public variables are not.
  • Class names start with a capital and the first character from each word within the name is capitalized: HerdAgent, Shepherd
  • Variable names start with a low-case letter and the first character from each word within is capitalized. A valid declaration would be: HerdAgent herdAgent, where the former is the name of the class and the latter is the name of the variable.

Collaborative work via GitHub

Each collaborator will work on a project, which will feature issues (they may be bugs or features to be added) and notes (which are more generic descriptions of a feature). These tasks need to be done before the project is finished and they will be moved in the project from "TODO" to "In progress", then to "Testing", then to "Finished". Going from "Testing" to "In progress" is, of course, an option. Issues may be assigned to a certain collaborator or the may be marked as help-wanted. These issues will be named using the following convention: first the name of the application the issue belongs to, a colon, and then, a short description. For example: "Badger: add a button in the report viewer to save all the reports". Inside the issue, a description will be added. Before starting on an issue, the collaborator will assign (if it has not already been assigned by the project owner) it to himself, letting the rest of collaborators know who is working on what. Each task (issue/feature) will be done in branch off the "develop" branch. The name of the branch may be a very short description of its goal (i.e, "badger-add-save-button") if more than one person is going to work on it, or include the assignee's name before the description (i.e, "dan-simmons-badger-add-save-button"). When a feature is finished (after testing the feature itself and making sure all the projects within the solution compile), then the feature's branch is merged with the "develop" branch (Team explorer->select develop branch->merge from->{my branch}).

Clone this wiki locally