Skip to main content

Best practices

  • Use functions to organize code.
  • Build the main function on a high abstraction level, explaining the functionality of the package.
  • Start the main function with guard clauses: if the input is not valid or further execution of the package is not needed, return early.
  • Keep functions short and simple and use clear, descriptive function names.
  • Keep code inside a function on the same abstraction level.
  • Give all information a function needs through its parameters.