Coding standards and code structure
Both Apollo and Diana are written following a set of coding standards that should
be followed strictly1throughout the code.
- Each class name should have the general form QClassName, without _ and using
capital letters where appropriate. The only exceptions are classes that inherit from
class QModule (i.e. the modules) which should have an M instead of Q.
- Class headers are in a separate file called QClassName.hh and class implementation
should be in file QClassName.cc. Each file contains code for one class only.
- Class variables should always be private. Class variables should begin
with letter f and using capital letters where appropriate. Example: fFileName.
static member variables should begin with g instead of f
- Each class header should include as first cuore header file QCuore.hh.
- The code should be well documented using doxygen keywords. Take as
an example class QVector in pkg/mathtools/ to learn how2.
- Each Diana module is generally kept in a separate package (i.e. directory).
However, in case of modules that are strictly linked together, we admit reasonable
exceptions to this rule.
The following are some additional points that explain the code structure and
define the role of the software manager, of the package
coordinators, of the developers and of the users.
- The code is structured in several packages, i.e. sub-directories of the main pkg
directory.
- Each package has a package coordinator, whose role is to maintain this piece of
code, discussing further developments with other developers and software coordinator.
- Each developer is free to create and add new classes to its own package. If the
class can be of general use, the developer should contact the software manager to see
if it is appropriate to locate the new class in a more general package.
- Each developer is free to commit new code into its own package(s). To
add or modify code in other packages, the developer should get in contact first with
the relevant package coordinators and in case of significant change with the software
manager.
- Whatever it is written in the previous, the most important one is always common
sense and flexibility. As far as the Cuore software developers group remains reasonable
small, any well motivated and exceptional violation of the above rules will be accepted.
This is not to encourage violations, but not to get stuck around the rules when needed.