[Cuis-dev] [Preference] Category as domain name

Hilaire Fernandes hilaire at drgeo.eu
Sat Jun 4 01:41:37 PDT 2022


Hi,

Below some important reflections based on the application of 
PreferenceNG to DrGeo's preferences.

In the current PreferenceNG design (true as well for the legacy 
preference design) we are not exploiting the full potential of the 
category attribute.

Indeed, there is no logical reason we can't have two preferences with 
the same name but under two different categories. In the current design 
it is not possible.

This is a problem that could arise quickly when loading two packages 
developed separately. The two developers may have both declared a 
preference named #textColor.

In package 'Zork':

     PreferenceNG
         name: #textColor
         category: #Zork
         value: #red

and package 'Zul':

     PreferenceNG
         name: #textColor
         category: #Zul
         value: #black

When both packages are installed, we have a preference name clash.


Exploiting category as a preference domain could reduce the complexity 
of preference name. Observe how these two preferences:

     PreferenceNG
         name: #DrGeoPointColor
         description: 'Default colour of a point.' translated
         category: #DrGeoPoint
         type:  (DrGTypeColor with: #DrGeoPointColor)
         value: Color red

     PreferenceNG
         name: #DrGeoSegmentColor
         description: 'Default colour of a segment.' translated
         category: #DrGeoPoint
         type:  (DrGTypeColor with: #DrGeoSegmentColor)
         value: Color black

could be better named as:

     PreferenceNG
         name: #color
         description: 'Default colour of a point.' translated
         category: #DrGeoPoint
         type:  (DrGTypeColor with: #DrGeoPoint:color)
         value: Color red

     PreferenceNG
         name: #color
         description: 'Default colour of a segment.' translated
         category: #DrGeoSegment
         type:  (DrGTypeColor with: #DrGeoSegment:color)
         value: Color black

In another email I will propose how to adapt the class and its protocol.

Hilaire

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220604/764b3d15/attachment.htm>


More information about the Cuis-dev mailing list