Skip to content

Difference between actions, utils and lib-packages

Status

Accepted.

Context

actions, utils and lib-packages can often consist of very similar code. It was not always clear enough where to place certain functionality, which was ultimately up to each developers own preference.

Decision

When deciding on where to place code (when writing or refactoring), the following ordered list should be followed:

  • Does the functionality also change some part of the state? action
  • Should the functionality be usable outside of an integrated client? action
  • Does the functionality not have state changes, but belongs to a certain action? Either locally in the same file as the action or in a folder named after the action in the path store/ACTIONNAME
  • Does the functionality not have state changes, but be reusable in the plugin / core? utils
  • Should the functionality be reusable for multiple plugins / the core? lib-package

Consequences

  • (+) Gives clarity on where specific code fragments should reside.
  • (-) This restriction must be manually enforced.