[Cuis-dev] The Preference model

Hilaire Fernandes hilaire at drgeo.eu
Thu Apr 28 02:13:00 PDT 2022


Le 27/04/2022 à 19:36, Mariano Montone via Cuis-dev a écrit :
>>
>> I don't understand the PreferenceType interest, why not subclassing 
>> Preference for specific model and behavior.
>>
> Personally I like the idea of being able to augment current 
> preferences in Cuis with type information, without introducing new 
> classes.
>
> We could go ahead and annotate current preferences with 
> preferenceType: Boolean,Integer,Color etc.
>
Using PreferenceType I fail to understand how it will reduce the 
quantity of needed classes to represent the whole model: a hierarchy of 
Preference or a hierarchy of TypePreference. The advantage of the former 
approach, the code is easier to understand as the behavior is 
concentrated in one class.

>> The visitor pattern makes the understanding more complex (your code 
>> snipped really show it) and as I understand it (I never used that 
>> pattern), it is for situation where the model can't be modified. It 
>> is not the case here as we are just discussing on the most 
>> appropirate model
>>
> I think I would use a Visitor in the end in any case. Let's say you 
> subclass Preference class and create StringPreference class. How do 
> you decide what class of widget to use for editing it? You would 
> "hardcode" the widget class somewhere in StringPreference class?
>
This information about the widget will come from the Package 
implementing the Prefrence widget (for example, adding a widget method 
to the preference, a registery in the widget package, ...). In the base 
image, the PreferenceString will remain clean of any widget information.

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/20220428/cfbd9f82/attachment.htm>


More information about the Cuis-dev mailing list