[Interest] Best practices for settings

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Nov 18 12:59:49 CET 2013


On Mon, Nov 18, 2013 at 5:24 PM, André Somers <andre at familiesomers.nl> wrote:
> Tomasz Siekierda schreef op 17-11-2013 17:29:
>> The settings class is a Singleton, and all options are accesible
>> through member variables (private + getters and setters, or public -
>> if you prefer). Although I personally believe Singletons are evil,
>> they can be useful - and this is one of the place where the benefits
>> outweight the problems.
> Singletons really are evil indeed. However, Qt already provides one, and
> you might as well use it: QApplication. We usually make our settings
> object a member of our own QApplication-derived Application class. That
> way, it is available where needed, but we don't have another singleton.

Do you provide any sort of access restrictions to the settings. Eg: if
some modules should only be able to read a particular setting and not
change it, where would you enforce this? in the module itself or
somewhere else or is this something not relevant in your context?

Thanks,
-mandeep

>
> André
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list