Coding Rules Updates
We had a discussion concerning a set of potential coding rules
to add to our current coding conventions:
http://www-glast.slac.stanford.edu/software/CodeHowTo/codeStandards.html
Use CLHEP classes, Point3D and Vector3D, over geometry
classes such as Point and Vector. All new code will use the CLHEP
classes, while older code will be upgraded as time allows
We will slowly attempt to phase out the geometry classes, Point and
Vector. Developers ae
Use const whenever possible; ex) when accessing TDS objects,
all "get" methods should be const.
Use of const allow clients of your class to fully utilize const instances of
your class.
Prefer iterators over index controlled for-loops.
Accessor methods to "get" will be named using a "get" prefix. set methods should be avoided in favor of setting up objects via a constructor or using an initialize method.
Standardize the use of units to conform to GLAST
conventions: MeV and mm.
All code will use MeV and mm, including all input parameter xml files for
individual package. There are two exceptions:
1.) The source XML files will require that the units, MeV or GeV, be
specified.
2.) The geometry XML files in xmlGeoDbs package will use mm and we had
initially decided that energies would require units, GeV or MeV. It
now appears that would require a bit of work. It is now suggested that
the geometry XML files will just conform to the MeV and mm standards.
TDS object classes should use the Gaudi provide fillStream
method to print out the contents of the class.
This can be accomplished by doing something like:
friend std::ostream& operator << (std::ostream& s, const
MyTdsClassi& obj){
return obj.fillStream(s);
};
virtual std::ostream& fillStream( std::ostream& s ) const {
return s << m_dataMember1 << m_dataMember2 <<
std::endl;
}
No hard-coded values in the code. Such values should be input parameters or at least assigned a static variable within the source file.
Toby suggested that we should look back at the Atlas Coding
Rules as we had started to a number of years ago. We found the following
current version:
http//atlas.web.cern.ch/Atlas/GROUPS/SOFTWARE/OO/qa/General/AtlasCCS1_1_2.pdf
We should take a look and determine what portions we are willing to adopt for our software effort.
Riccardo discussed the status of the coding rules checker.
http://www.fisica.uniud.it/~riccardo/research/glast/rules/rules.html
H. Kelly Last Modified: 2002-12-02 11:40:22 -0800