jabref icon indicating copy to clipboard operation
jabref copied to clipboard

org.jabref.preferences.JabRefPreferences class might need to be divided into simpler classes

Open dimitrisdimos00 opened this issue 3 years ago • 2 comments

Having calculated the Chidamber-Kemerer metrics on the whole JabRef project using the Intellij plugin metricsreloaded, it seems that JabRefPreferences is the class with the highest WMC (Weighted Methods Per Class) and RFC (Response for a class) values. WMC corresponds to the number of methods a class has while RFC corresponds to the number of methods of a class plus the number of secondary methods being called by each method. Classes with high WMC and RFC values are more prone to errors, more complicated and more difficult to understand. This is the reason why I am suggesting this class to be divided into two or more new classes. image

dimitrisdimos00 avatar Jun 19 '22 15:06 dimitrisdimos00

This could be a case where code metrics fail. Please read the code and the usage of the class. We already have minimal preference classes. The class you are referring to, is the collection class of all preferences.

The alternatives are IMHO dependency injection and factory pattern .

Solving this issue will be a task with 100 to 1000 hours effort.

koppor avatar Jun 19 '22 16:06 koppor

In fact we are in a long term refactoring progress of the prefs service, but as jabref is only a project for our free time, we can only work on this from time to time. If you are interested in working on this, please contact us, because we already spent a lot of time drafting a concept for this.

calixtus avatar Jun 19 '22 16:06 calixtus

Thanks for your interest in JabRef programming. As this issue is merly a code quality suggestion but a real issue and code quality is always been worked on, I will close this for the sake of gaining at least a tiny bit more oversight on our issue board.

calixtus avatar Nov 02 '22 19:11 calixtus