Which design patterns can be applied to the configuration settings problem?

I prefer to create an interface for setting query, loading, and saving. By using dependency injection, I can inject this into each component that requires it.

This allows flexibility in terms of replacing the configuration strategy, and gives a common base for everything to work from. I prefer this to a single, global “settings loader” (your option 2), especially since I can override the configuration mechanism for a single component if I absolutely need to do so.

Leave a Comment