Background for BaBar Offline Programming Recommendations
Based on sections of the standards document draft
of August, 1996, by David R. Quarrie, LBNL. Last updated March 27, 1999
These guidelines are intended to improve programmer productivity
and to promote the development of software that is easy to maintain.
The overall goal is develop reliable software that can easily
be updated to accommodate unforeseen changes throughout the lifetime
of the experiment. An important component in achieving that is
that the software should be clear and understandable, not only
to its original author, but also to other collaborators. Such good
programming practices can significantly reduce the debugging phase
of program development and ensure easy integration into the overall
system.
These guidelines therefore detail both common pitfalls and methods
of avoiding them, together with references to some templates and
example programs that can ease the development of new software
and result in a more uniform coding style than would otherwise
be possible. This uniformity can considerably ease the burden
on the person who has to maintain code since they will know where
to find components of the code modules and in which sequence major
subsections will appear. A uniform and consistent naming convention
should prevent name conflicts when large and complex programs
are created that use code from many different libraries. Such
a naming convention can also ease the burden on the maintainer
by allowing differentiation between local and external variables
etc.
The overall philosophy for software development within the
BaBar
Collaboration is to balance the number of rules and regulations
by promoting good software practices through early adoption of
the code templates and sample programs in conjunction with these
guidelines. However, there will be some monitoring of the software
quality, especially in areas where there is the potential for
irretrievable loss of data (e.g. the on-line triggering and run-control).
When you are writing code, be aware that someone other than yourself
will probably look at it and that the insertion of extra comments
and adherence to the recommended style guidelines will help even
yourself when you look at the code again in several months time.
A tiered approach to software quality monitoring will be taken,
and software that is deemed adequate at one level (e.g.
your own physics analysis) might well be considered unacceptable
at a higher level (e.g. bulk production) if you do not
adhere to these guidelines.
These recommendations are based on both the experience of other
organization (see the
Bibliography section
for more information) and our own experience over the past years.
As such, they represent an evolving concensus.
As a result of a recommendation by the Computing Group to the
collaboration, the C++ language has been selected as the primary
programming language for the development of
BABAR
software. Note that ANSI C is allowed as a subset of C++ in areas
where, for example, a C++ compiler is unavailable (e.g.
Front-end boards), or there are other limiting factors.
FORTRAN-77, with a few extensions, is allowed within the context
of the GEANT-3 based Monte-Carlo simulation program. This is the
only context where new FORTRAN code is allowed. A plan to migrate
to the C++ based GEANT-4 simulation framework is in place.
Existing FORTRAN code can be utilized within BABAR
software by "wrapping" it with C++.
Guidelines and Tutorials
- Ellemtel Telecommunication
Systems Laboratories, Programming in C++: Rules and Recommendations
- Stanley B. Lippman, C++ Primer, (2nd edition), Addison-Wesley,
1991, ISBN 0-
- John J. Barton, Lee R. Nackman, Scientific and Engineering
C++, Addison-Wesley, 1994, ISBN 0-201-53393-6
Reference Books
- Margaret A. Ellis, Bjarne Stroustrup, The Annotated C++
Reference Manual, Addison-Wesley, 1990 (1992 corrections),
ISBN 0-201-51459-1
Object Oriented Methodology
- Robert Martin, Designing OO C++ Applications using the
Booch Method, Prentice Hall, 1995, ISBN 0-13-203837-4
- Erich Gamma, et al., Design Patterns: Elements of reuseable
object-oriented software, Addison Wesley, 1995, ISBN 0-201-63361-2
- Iseult White, Using the Booch method: a Rational approach,
Benjamin Cummings, 1994, ISBN 0-8053-0614-5
- Grady Booch, Object-oriented Analysis and Design with Applications
(2nd edition), Benjamin Cummings, 1994, ISBN 0-8053-5340-2
|