33.2 Objects and Free-Functions

OEChem is an object-oriented library. However, we have taken a design philosophy that molecule objects are primarily data containers with data access member functions. Most powerful data analysis and manipulation routines in OEChem are implemented as free functions rather than member functions. This decision is based on the realization that the abstraction of a molecule can be neither stable nor consistent. To one programmer, a molecule should describe and perceive the space group of organometallic complexes, while to another a molecule should describe the residues and secondary structure of a macromolecule. Both of these perspectives are reasonable and should be supported. Further, a nearly infinite additional list of molecule designs can be imagined and should be supported. In order to do this, the OEChem molecule must be extensible, light-weights, and easily re-implemented. Thus, can make major changes to the OEChem molecules, without needed to re-implement more than a handful of functions. Conversely, we can add an entire new area of chemistry to the OEChem repertoire through free-functions without needing to implement the function in multiple molecules. We have used namespaces extensively to keep the free-functions from cluttering the global namespace.