Programming Standards

Just some standards for writing applications I came up with to make it easy to deal with, fast and provide a high level of availability.

  • Use a maintainable programming language
  • Write readable code (not smart code)
  • Use GNU syntax for parameters
  • Provide help message with description of parameters and legal values
  • Provide examples for all functionality in documentation
  • Provide a complete man page
  • Make all documentation available
  • Produce machine readable output in yaml or json syntax
  • Provide auto completion support for calling the application using a shell (e.g. bash, zsh)
  • Configurable logging
  • Written in maintainable language
  • Use YAML for configuration files
  • Allow passing in of secrets via FDs
  • If it’s a service, implement seamless restarts using systemd notify and passing of fds and state
  • Use sd-notify to report state and readiness
  • Multi threaded where possible
  • Thread pool
  • Configuration system allows overwriting of settings in other files
  • Configuration system allows including via globbing from relative to config file or absolute path
  • Internal state has to be serialisable, loadable from external source
  • Plugin systems must allow loading and unloading of plugins during run time
  • Plugin system must allow authentication of plugin files
  • Allow privilege separation
  • Must be able to reload its own settings and secrets during run time
  • Provide any error or warning messages in a structure that specifies the type of error and any other associated information, as well as a method to transform the structure in a human readable string describing the error and its context.