Skip to content

matRad Style Guidelines

Amit Bennan edited this page May 6, 2022 · 1 revision

Advice on writing code for the matRad project to help us maintain correct, understandable, shareable and maintainable code.

Variables:

  • When naming variable follow the "camel case" i.e. variable names in mixed case starting with the lower case, e.g. numOfBeams
  • Variables with larger scope should have meaningful names. Variables with shorter scopes can have short names.
  • Use common domain-specific names.

Functions:

  • Function names follow the "camel case " after the matRad_ prefix, e.g. matRad_fluenceOptimization()
  • High level functions or functions that are active in the main workflow are only passed high level structures as arguments.
  • Lower level functions that have a single and specific tasks may be given structure fields, temporary variables and other variables as arguments
  • As a newer convention, the passing of arguments may be handled with "varargin" which may be parsed for Name-Value pairs (inputParser )

Classes

Comments and documentation

  • the opening comments and documentation of functions must include a description of the function including citation to literature and functionality
  • must include a list and description of the arguments passed to the function including default values
  • include a list and description of the returned values