Re: XML attribute value indirection

List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> Tue, 11 Oct 2005 18:44:36 -0600
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
--===============2144775532==
Content-Type: multipart/alternative; 
	boundary="----=_Part_13519_15023195.1129077876401"

------=_Part_13519_15023195.1129077876401
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thx for weighing in on this Wolf.

I agree that localization better not be confused w/ indirection.

Still, I need indirection because it helps me centralize setting things and
helps avoid much duplication. And as we all know duplication is the enemy o=
f
maintainability. I was hoping we'd somehow agree to address this need (I'm
not hung up on the implementation details ;-).

The solution you propose, namely that I write my own font converter does no=
t
scale well. After all, if I want to code this stuff directly, then I can do
away w/ the XML file altogether.

Regards,
-Babak.

On 10/11/05, List for Users of Carlsbad Cubes' Technologies and Products <
[email protected]> wrote:
>
> After talking with a couple Swixml developers offline, I don't think we
> should
> implement general attribute indirection like is was proposed in this
> thread.
>
> I don't want to see localization to be confused or mixed with using
> 'indirect
> attributes values', basically trying to use localizaion as a string
> pre-processor.
>
> If you want to flag attribute values that require localization with an '@=
'
> character, you are free to do so, by prefixing your keys with an @
> character
> too.
>
> If you want to <i>'sprinkled font=3D"SansSerif--12" liberally everywhere
> across
> the file'</i>, I suggest you simply overwrite the FontConverter.
>
> Changing the Parsers behavior in respect to which attr. are considered fo=
r
> Localization is as simple as adding or removing attribute names to/from
> the
> public vector: Parser.LOCALIZED_ATTRIBUTES
>
> /**
> * Localiced Attributes
> */
> public static final Vector LOCALIZED_ATTRIBUTES =3D new Vector();
>
> Converter classes are extreemly simple pieces of code and should be
> replaced
> (unregistered) or overwritten, if this kind of speacial functionality is
> needed.
>
> BTW, the Class parameter is used somewhere, I think in the
> PrimitiveConverter.
> Moreover, the converter model was built with the idea that developers
> would
> implement there own converters, we wanted to make them as flex. as
> possible and
> therefore added the Class param...
>
> --
> Wolf Paulus
> 707.202.3937
> [email protected]
>
> C a r l s b a d C u b e s
> Dedicated to Excellence
>
>
>
> Quoting List for Users of Carlsbad Cubes' Technologies and Products
> <[email protected]>:
>
> >>
> >> I assume you would like to change the Converter.convert(Class,
> Attribute,
> >> Localizer) to
> >> Converter.convert(Class, Attribute, Object localizedAttributeValue),
> >> correct?
> >>
> >
> > Actually, I was thinking the change would look more like
> >
> > Converter.convert(Class, Attribute)
> >
> > The reason why I thought this way is that the Parser only deals w/
> strings;
> > and the Converters' job is to turn those strings into other kinds of
> objects.
> >
> > The Parser (as demo-ed unclearly in the diff I submitted) just examines
> > the attribute value, and if that value needs to be "translated", it jus=
t
> > replaces the translated value with the original:
> >
> >
> > < String key =3D attr.getValue();
> > < String value =3D getChainedLocalizer().getString(key);
> > < if (!key.equals(value))
> > < attr.setValue(value);
> >
> >
> > -Babak.
> >
> > P.S. On a separate note--but while we're on the topic-- I'm not sure
> > I understand what role the "Class" parameter in Converter.convert()
> plays?
> > After all, by the time we pick the right Converter, we already know
> > what type it will be converting to... (It's not like the caller can
> > *tell* the
> > implementation which type to convert to, and I can't find a single plac=
e
> > where a Converter implementation uses this parameter...)
> >
> > _______________________________________________
> > Forum mailing list
> > [email protected]
> > http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
> >
>
>
>
>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>

------=_Part_13519_15023195.1129077876401
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thx for weighing in on this Wolf.<br>
<br>
I agree that localization better not be confused w/ indirection.<br>
<br>
Still, I <span style=3D"font-weight: bold;">need </span>indirection
because it helps me centralize setting things and helps avoid much
duplication.&nbsp; And as we all know duplication is the enemy of
maintainability.&nbsp;<span style=3D"font-style: italic;"> I was hoping we'=
d somehow agree to address this need</span> (I'm not hung up on the impleme=
ntation details ;-).<br>
<br>
The solution you propose, namely that I write my own font converter
does not scale well.&nbsp; After all, if I want to code this stuff
directly, then I can do away w/ the XML file altogether.<br>
<br>
Regards,<br>
-Babak.<br><br><div><span class=3D"gmail_quote">On 10/11/05, <b class=3D"gm=
ail_sendername">List for Users of Carlsbad Cubes' Technologies and Products=
</b> &lt;<a href=3D"mailto:[email protected]">[email protected]=
</a>
&gt; wrote:</span><blockquote class=3D"gmail_quote" style=3D"border-left: 1=
px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"=
>After talking with a couple Swixml developers offline, I don't think we sh=
ould
<br>implement general attribute indirection like is was proposed in this th=
read.<br><br>I don't want to see localization to be confused or mixed with =
using 'indirect<br>attributes values', basically trying to use localizaion =
as a string
<br>pre-processor.<br><br>If you want to flag attribute values that require=
 localization with an '@'<br>character, you are free to do so, by prefixing=
 your keys with an @ character<br>too.<br><br>If you want to &lt;i&gt;'spri=
nkled font=3D&quot;SansSerif--12&quot; liberally everywhere across
<br>the file'&lt;/i&gt;, I suggest you simply overwrite the FontConverter.<=
br><br>Changing the Parsers behavior in respect to which attr. are consider=
ed for<br>Localization is as simple as adding or removing attribute names t=
o/from the
<br>public vector: Parser.LOCALIZED_ATTRIBUTES<br><br>&nbsp;&nbsp;/**<br>&n=
bsp;&nbsp; * Localiced Attributes<br>&nbsp;&nbsp; */<br>&nbsp;&nbsp;public =
static final Vector LOCALIZED_ATTRIBUTES =3D new Vector();<br><br>Converter=
 classes are extreemly simple pieces of code and should be replaced
<br>(unregistered) or overwritten, if this kind of speacial functionality i=
s<br>needed.<br><br>BTW, the Class parameter is used somewhere, I think in =
the PrimitiveConverter.<br>Moreover, the converter model was built with the=
 idea that developers would
<br>implement there own converters, we wanted to make them as flex. as<br>p=
ossible and<br>therefore added the Class param...<br><br>--<br>Wolf Paulus<=
br>707.202.3937<br><a href=3D"mailto:[email protected]">wolf@carlsbadc=
ubes.com
</a><br><br>C a r l s b a d&nbsp;&nbsp;C u b e s<br>Dedicated to Excellence=
<br><br><br><br>Quoting List for Users of Carlsbad Cubes' Technologies and =
Products<br>&lt;<a href=3D"mailto:[email protected]">Forum@carlsbadcu=
bes.com</a>
&gt;:<br><br>&gt;&gt;<br>&gt;&gt; I assume you would like to change the Con=
verter.convert(Class, Attribute,<br>&gt;&gt; Localizer) to<br>&gt;&gt; Conv=
erter.convert(Class, Attribute, Object localizedAttributeValue),<br>&gt;&gt=
; correct?
<br>&gt;&gt;<br>&gt;<br>&gt; Actually, I was thinking the change would look=
 more like<br>&gt;<br>&gt; Converter.convert(Class, Attribute)<br>&gt;<br>&=
gt; The reason why I thought this way is that the Parser only deals w/ stri=
ngs;
<br>&gt; and the Converters' job is to turn those strings into other kinds =
of objects.<br>&gt;<br>&gt; The Parser (as demo-ed unclearly in the diff I =
submitted) just examines<br>&gt; the attribute value, and if that value nee=
ds to be &quot;translated&quot;, it just
<br>&gt; replaces the translated value with the original:<br>&gt;<br>&gt;<b=
r>&gt;
&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;
String key =3D attr.getValue();<br>&gt;
&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;
String value =3D getChainedLocalizer().getString(key);<br>&gt;
&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;
if (!key.equals(value))<br>&gt;
&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
attr.setValue(value);<br>&gt;<br>&gt;<br>&gt; -Babak.<br>&gt;<br>&gt; P.S.&=
nbsp;&nbsp;On a separate note--but while we're on the topic-- I'm not sure<=
br>&gt; I understand what role the &quot;Class&quot; parameter in Converter=
.convert
() plays?<br>&gt; After all, by the time we pick the right Converter, we al=
ready know<br>&gt; what type it will be converting to...&nbsp;&nbsp;(It's n=
ot like the caller can<br>&gt; *tell* the<br>&gt; implementation which type=
 to convert to, and I can't find a single place
<br>&gt; where a Converter implementation uses this parameter...)<br>&gt;<b=
r>&gt; _______________________________________________<br>&gt; Forum mailin=
g list<br>&gt; <a href=3D"mailto:[email protected]">Forum@carlsbadcub=
es.com
</a><br>&gt; <a href=3D"http://carlsbadcubes.com/mailman/listinfo/forum_car=
lsbadcubes.com">http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcub=
es.com</a><br>&gt;<br><br><br><br><br>_____________________________________=
__________
<br>Forum mailing list<br><a href=3D"mailto:[email protected]">Forum@=
carlsbadcubes.com</a><br><a href=3D"http://carlsbadcubes.com/mailman/listin=
fo/forum_carlsbadcubes.com">http://carlsbadcubes.com/mailman/listinfo/forum=
_carlsbadcubes.com
</a><br></blockquote></div><br>

------=_Part_13519_15023195.1129077876401--


--===============2144775532==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Forum mailing list
[email protected]
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com

--===============2144775532==--