Best practice to propagate preferences of application

Posted by Shebuka on Programmers See other posts from Programmers or by Shebuka
Published on 2012-09-28T09:12:09Z Indexed on 2012/09/28 15:50 UTC
Read the original article Hit count: 427

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).

© Programmers or respective owner

Related posts about programming-practices

Related posts about class-design