<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">I'm looking at Squeak model for
preferences and they have something similar to what I suggest.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">They have a 'type' instance variable in
Preference, that they assign to a Symbol (I would use Smalltalk
classes and objects instead).</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">And then, they have a hierarchy, but
not for Preference or preference types, but for views.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">And instead of a visitor, they use a
registry, a mapping from preference type -> preference view
class (PreferenceViewRegistry class).</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Perhaps we can get some ideas from
Squeak model.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Cheers,</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Mariano</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">El 27/4/22 a las 14:36, Mariano Montone
escribió:<br>
</div>
<blockquote type="cite"
cite="mid:d6e460af-0cd7-993b-e0f5-6c8094d87033@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">El 27/4/22 a las 13:56, Hilaire
Fernandes via Cuis-dev escribió:<br>
</div>
<blockquote type="cite"
cite="mid:e7766d4a-e475-f7cc-3832-17b62a9b9381@drgeo.eu">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<p><font size="4">Hi, <br>
</font></p>
<p><font size="4">I don't understand the PreferenceType
interest, why not subclassing Preference for specific model
and behavior. <br>
</font></p>
</blockquote>
<p><font size="4">Personally I like the idea of being able to
augment current preferences in Cuis with type information,
without introducing new classes.</font></p>
<p><font size="4">We could go ahead and annotate current
preferences with preferenceType: Boolean,Integer,Color etc.<br>
</font></p>
<blockquote type="cite"
cite="mid:e7766d4a-e475-f7cc-3832-17b62a9b9381@drgeo.eu">
<p><font size="4"> </font></p>
<p><font size="4">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<br>
</font></p>
</blockquote>
<p><font size="4">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?</font></p>
<p><font size="4">My preference is to use a Visitor (that's how it
is done in my packages; I have a PreferenceWidgetBuilder that
given a preference type builds a widget for it. ). <br>
</font></p>
<blockquote type="cite"
cite="mid:e7766d4a-e475-f7cc-3832-17b62a9b9381@drgeo.eu">
<p><font size="4"> </font></p>
<p><font size="4">I am slightly concern it will be over
engineered.</font></p>
</blockquote>
<p><font size="4">I understand. This is how I would do it, </font><font
size="4"><font size="4"><font size="4">and see it as a price
to pay</font></font> in order to prevent introducing new
classes and for the possibility of having separate widget
building objects. But have no problem with doing it in some
other way if it is decided that this is unnecessarily complex.</font></p>
<p><font size="4">Mariano<br>
</font></p>
<br>
</blockquote>
<p><br>
</p>
</body>
</html>