File Structure

From ScorecWiki

Jump to: navigation, search

Libraries and Programs

Wikipedia says: Libraries contain code and data that provide services to independent programs. This allows the sharing and changing of code and data in a modular fashion. Some executables are both standalone programs and libraries, but most libraries are not executables. Executables and libraries make references known as links to each other through the process known as linking, which is typically done by a linker.

When starting a project, ask yourself, am I writing a library or a program? You may find the answer is both.

Use of Project and Sub-projects

File tree organization

  • Class definition shall be implemented in a separate file. The name of file shall be class name.
  • A file shall not implement several classes in a file
  • If a class definition is too large to be implemented in a file, divide it into several files and name them to be distinguished using a section name which describes why the code is divided.
  • .h files should be defined in include folder whereas .cc files should be defined in source folder.
  • If you are willing to define several source directories, you might need to create a new fully independent component. Think first before defining hundreds of source folders
  • For developers the folder organization should follow the following pattern:
    • src
      • Subdirectory 1 with corresponding .cc and .h files
      • Subdirectory 2
      • ...
    • tests
      • unit using appropriate software testing suite such as CppUnit
        • API functions
        • Code internal functions
      • Alpha test: test a set of software component functionalities that does not require integrating the code to another software. Examples could include the execution of successive mesh operations (mesh creation, traversing vertices, mesh deletion etc)
      • Integration test: tests a specific software component being used by an application. Examples include the use of FMDB by meshAdapt or phParAdapt.
    • doc (Full documentation - doxygen format)
    • dependencies ???
  • For users the folder organization should follow the following pattern:
    • include
    • bin
    • lib
    • Reduced documentation (doxygen format)
    • dependencies

Note on dependencies: By default all depend code components will be downloaded as part of the package. The user should be able to not download all dependent software components using specific options. The user will then be responsible for setting appropriate environment variables.

Example:

branches
trunk
  doc
    [Doxyfile and generated documentation]
  src
    [code]
  tests
Personal tools