Best practice to propagate preferences of application
- by Shebuka
What is your approach with propagation to all classes/windows of preferences/settings of your application?
Do you share the preference_manager class to all classes/windows who need it or you make variables in each classes/windows and update them manually each time setting are changed?
Currently I have a PreferencesInterface class that hold all preferences and is responsible to default all values with a dedicated method called on create and when needed, all values are public, so non getters/setters, also it have virtual SavePreferences/LoadPreferences methods.
Then I have PreferencesManager that extends from PreferencesInterface and is responsible for actually implementation of SavePreferences/LoadPreferences. I've made this basically for cross-platform so that every platform can have a different implementation of actual storage (registry, ini, plist, xml, whatever).