I am looking for specific ideas on how to control many different parameters for my java program. I know this question is a bit blurry, but I need some ideas about the big picture to make my code more convenient.
What my project does is the implementation of many stages of data processing, mainly text. These processing steps are algorithms of varying complexity, which often have many settings. I would also like to change which processing steps are used, for example, configuration files.
The reason for my program is to perform repeated experiments, and because of this I need to be able to get a complete picture of all the parameters used in different parts of the code, preferably in a good format.
At this stage (prototype), I have settings in the source code, for example:
public static final param1=0.35;
and each class responsible for a certain processing step has its own hard-coded settings. This is actually quite scary, because there is no easy way to change the situation or even see what has been done and with what parameters / settings.
My idea is to have a central repository of keys / values for all settings, which also supports resetting all settings. Example:
k:"classA_parameter1",v:"0.35" k:"classC_parameter5",v:"false"
However, I would not want to just store the parameters as strings, but associate them with the actual class or java object.
Is it smarter to have a singleton "SettingsManager" that controls everything. Or to have a SettingsManager object in each class that the master has access to? I don’t really like to store string descriptions of settings, but I don’t see another way (say, one parameter is the SAXparser implementation that is used, and the other parameter is double, for example, percentage), since I really do not want to store them as Objects and throw them.
Experience and links to pages on relevant design patterns are welcome.
To clarify, my experiments could be considered as a series of algorithms that work with data from files / databases. These algorithms are grouped into different classes depending on their task in the whole process, for example.
Experiment //main InternetLookup //class that controls eg web scraping ThreadedWebScraper LanguageDetection //from "text analysis" package Statistics //Calculate and store statistics DatabaseAccess DecisionMaking //using the data that we have processed earlier, make decisions (machine learning) BuildModel Evaluate
Each of the lower-level classes has parameters and is different, but I still want to get an idea of everything that happens.