I'm facing a design problem in my application related to its configuration.
Let's assume we have some huge domain, which can be divided into several subdomains. Each subdomain should use the same as generic as possible code and all the differences should be stored in the configuration - one for each subdomain. Subdomain configuration items can be present in many subdomains and some of them can be unique to only one subdomain. Simple example to imagine this: some taxes values in different countries can be the same but additionally there could be values, which are not present in any other country.
Most of the configuration items are arrays of some objects and I would like to have quick access to every item via some constants just like enums because of the business logic. I don't want to keep loaded values in an array, list or similar structure and prepare code to search for correct value each time - I'm afraid of performance loss.
My idea is was to create some generic abstract class keeping data in a list and for each subdomain create subclass with constants referring to each value but it does not sound good from maintenance perspective.
I'm considering keeping such configuration in YAML or JSON format.
Are there any design patterns, which helps to achieve satisfying results? Or maybe my whole concept is wrong? This configuration is the basis of whole application and I want to avoid potential issues with it when the project will be too advanced.
Aucun commentaire:
Enregistrer un commentaire