Question

Imagine a software system where you have like 100 parameters, each of which is sensible to change (in my case this is a reasearch system for machine learning). The obvious solution is to store all parameters in a config file, so that the system is easy to handle and see through.

Whis approach is better, what are benefits and disadvantages:

  • a) load the config file at the entry point of the program and pass down a big collection of config variables through each method in the code
  • b) load the config file at the entry point of the program and pass down the relevant collection of config variables through each method in the code
  • c) load the config variables directly where they are needed
  • d) load the config and make it global

I'm open for any suggestion or examples of a particular implementation. At the moment I'm experimenting with nested config variables, each nested object storing config of different modules in the code.

Was it helpful?

Solution

YAML, JSON or XML are often used in frameworks for managing config settings. Depending on the language you are using, another option can be to use a structured entity (ie in a OO language using a class) to hold your config settings.

OTHER TIPS

Like @theatlasroom mentioned use some technique to structure your config-parameters. When that is in place, and since the parameters are "sensible to change" you might consider building some interface for editing them. Having one, it can guard against unreasonable or harmful values (some times entered by mistake) giving the user guidance.

Licensed under: CC-BY-SA with attribution
scroll top