R – Program setting design pattern

design-patternssettings

I want to have the changing setting of my program to take effect right away rather than rebooting my program, what design pattern is suitable here.

  1. have a centric setting class, once the setting changed it has to update the property of objects that need to be updated, if the number of objects is big, this will create unnecessary dependencies between objects and the settings

  2. how about observer pattern, but it seems this pattern is not suitable here either. Then i have to add event handler to the objects, but seems this is not the responsibility of objects.

what's your solution?

Best Solution

  1. is not a good idea. You would not want your settings object to know about all these objects. The other way around is definetely better.

  2. -> why is this pattern not suitable here?