Is a “master preferences” class a good idea?

前端 未结 6 1583
走了就别回头了
走了就别回头了 2021-02-06 06:50

I have a class that manages user preferences for a large software project. Any class in the project that may need to set or retrieve a user preference from a persistent store i

6条回答
  •  梦谈多话
    2021-02-06 07:25

    Can't you just handle preferences in a really generic way? You'd then just use the preference manager to handle the persistence. So from a class you'd just say to the preference manager PreferenceManager.setPreference(key, value) and it doesn't care what it's saving in terms of the semantics of the data.

    Or am I simplifying this too much?

提交回复
热议问题