
The purpose of this document is to present the programming rules to be applied in the Open TURNS project for the coding of classes and modules in the C++ and Python languages.
The rules are not intended to restrain the expression of developers. Following the rules allows the development of C++ and Python source code that can be understood by any developer and any newcomer to the project. Moreover, the rules help avoiding pitfalls that are common and classical in C++ and Python, thus ensuring a source code of high quality, i.e. readable, efficient and reliable. Furthermore, following the programming rules is a sign of respect towards the other developers and the future maintainers of the Open TURNS code.
The document addresses the modular structure of the Open TURNS code, the file names and the two main languages used: C++ and Python. Whenever possible, examples and counterexamples are provided to illustrate the application of each rule.
The basic rules regarding how to structure the files and directories, and how to carry out unit tests in the development environment, are not described in this document. These processes, as well as the processes for revision control and managing the evolution of the source code and modules, are described in the Software Configuration Management Plan of the Open TURNS project and rely on Subversion.
1.1 Document goals
1.2 Conventions
2.1 Packages
3.1 C++ Files
3.2 Header files
3.3 Test files
4.2 Namespaces
4.3 Names
4.5 Inheritance
4.6 Function and method declaration
4.9 Comments and internal documentation
4.10 Memory allocation and deallocation
4.11 Assignment and initialization
4.12 Instructions
4.13 Exceptions
4.14 Error handling and error messages
5.2 Names
5.3 Comments and internal documentation