[Interest] Best practices for settings
André Somers
andre at familiesomers.nl
Mon Nov 18 13:57:15 CET 2013
Philipp Kursawe schreef op 18-11-2013 13:25:
>
>
>
> On Mon, Nov 18, 2013 at 12:45 PM, André Somers <andre at familiesomers.nl
> <mailto:andre at familiesomers.nl>> wrote:
>
> I often see with OO programmers that they very quickly turn to
> subclassing to use a class they find useful. Somehow, encapsulation
> doesn't seem to get the same amount of attention as inheritance does.
> Inheritance is not the tool to use here, I think.
>
>
> I am are of encapsulation, but it forces a new API on the programmers
> of the plugins. When they are used to QSettings why introduce a new
> interface?
Because IMnsHO the API of QSettings is useful to talk to a settings
backend, but not so useful as an API for an application to talk about
its specific settings. Do you really want to use strings as keys and
cast to and from QVariants throughout your code? I don't. Just like many
other posters, I much prefer an API where the settings are explicitly
coded and type safe. That is: there are explicit getters, setters and
where needed, signals for each of them.
André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131118/f2da152d/attachment.html>
More information about the Interest
mailing list