Skip to content

Structure of preferences #1058

@oscargus

Description

@oscargus

Based on the Wiki and #658 I would like to discuss what the preferences should look like. As an example consider the OpenOfficePreferences in #1047. When designing that I faced a number of problems which, well, were not solved as in #658. Let me outline the issues, how #658 and #1047 differs and how it might be solved.

First, the purpose, I assume, is to provide an intermediate "layer" which handles preferences for a specific subset of the code. In #1047 it was all the preferences related to the OO connection. This makes sense since one can have nicely named methods and not have to access JabRefPreferences from a lot of different classes.

"logic and gui should not know JabRefPreferences":
Where should the Preferences class be stored? Should there be another main branch, preferences, where OpenOfficePreferences are in preferences.openoffice? In this way one can enforce this through tests.

What about splitting the current JabRefPreferences in three classes?

  1. Constants
  2. Default values
  3. The actual preference handling
    This would simplify the maintenance a bit as it provides a better overview. JabRefPreferences is quite huge at the moment...

Where are the default preferences set and how are an object constructed?
In #658 the default values are added to JabRefPreferences and the class has a special method that takes a JabRefPreferences, and returns an instance with a special call in JabRefMain(?) as the constructor taken the preference values. In #1047 the constructor has JabRefPreferences as an argument and inserts default values on construction. The object in constructed in OpenOfficePanel, i.e., where it is in needed. Advantage in #658, easier to construct an object with a different set of preference values. (I'm actually a bit confused here as it wasn't obvious where the ProxyPreference object is actually used and I am too tired at the moment to check). Drawback with #1047: default preferences are only put in the preferences if OpenOfficePanel is instantiated. Advantage with #1047: the default values are "near" the preference class.

I realize that this is a bit vague and I was hoping for a more stringent proposal, still I hope this can raise some discussion.

Finally, would it make sense to add some method that removes selected preferences in the preference list? For example, all (except for maybe those in #1047 unless OpenOfficePanel is used) preferences with a null default value are probably obsolete and currently there are quite a few in at least my preference list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions