I have a
yml configuration file that list multiple application. Each application can contain multiple configuration. And of course each configuration can contain multiple mode
apps: - name: foo group: - group_1 configs: - name: config_1 options: [a, b, c] solution: solution path modes: - name: mode_1 options: aaaa - name: mode_2 options: ... - name: config_2 ... - name: bar group: - group_2 configs: ...
I have designed a
Collection object that store all these applications as object. An application will have a name, group and a list of config object. Same for the config, it will have a name, options and a list of modes object...
My question lies here. One of the api of my framework will need a specific application configuration to be used. It will need an object that contain the name of an application, the name of one of it's config and a mode of this config.
class AppConfig: name: str config: str mode: str def the_api(appconfig): pass
Is it better to store in the collection a list of every single type of configuration (flatten the entire yml into multiple AppConfig object) or do what I have done (Create an App object that contain a list of config...) filter the collection and create an AppConfig object that will be use by the api when needed?
Is there any design pattern for this ?
I believe that the answer might be just a question of time processing versus a well architectured framework that will be able to evolve easily. Does anyone had encounter this king of situation ?