QMCPACK adopts many advanced C++ techniques based on template. Ultimately, one should be able to generate an executable tailored for an application by template instantiation but more conservative approaches are taken in the current implementation. It is too time consuming: compilation can take hours.
And, not all compilers are created equal and some of them will fail to optimize relatively simple C++ .
The guiding principles are
- use template programming for computationally simple and critical components
- use standard object-oriented practices for physical abstractions
- use design patterns
Things to consider for large-scale C++ projects
- Try to reduce the dependency. Forward declaration should be used in header files, if only the pointer or the reference to a class is used in a dependent header file.
- It is seldom necessary to define concrete member functions in a header file. Declare them in a header file but implement them in compilation units (*.cpp files).
- Especially when the function body is complex, put them in a compilation unit.
Taming of C++
Add your favorite sources for C++.
Tools for development, XML and modelling
- C++ IDE: Those who are
not familiar with C++ should consider using eclipse CDT or any IDE which can
generate the class and API index.
- XML editor, Schema tools
- UML tools
- Visual tools like graphviz