[jsword-devel] Config/XML (Was: SkinLF)
Joe Walker
jsword-devel@crosswire.org
Tue, 30 Dec 2003 09:16:37 +0000
Aleksander Rozman - Andy wrote:
> At 12/29/2003, you wrote:
>
>> Aleksander Rozman - Andy wrote:
>>
>>> Yeah I have another great question. Why do you use XML files for
>>> configuration file. There are a lot of ways to configure software and
>>> instanciating about 30 classes to be able to read few settings is
>>> really not a way to go. Java has a nifty class called Properties,
>>> which can do everything... With a little memory.
>>
>>
>> The configure system does use properties files to store the
>> properties. The XML configures the configuration system. If you can
>> replace config.xml using a properties file and have it:
>> - be as easy to read as xml
>
> YES and writable too..
No I mean, convert config.xml to config.properties, and have it as
readable to a human as config.xml.
>> - be syntax checked by a DTD
>
> Properties files don't have DTD
Exactly, so if you spell something wrong the system just doesn't work.
Config will warn you about where your mistake is. A property file won't.
>> - convert to code using xsl to perform a lower level check
>> - generate a GUI without coding
>> - not polute other classes with config dependent code
>
> Nice feature that you have self updating config, but so far I haven't
> seen any *good* fruits of that labor, except there is a lot more code
> than needed.
>
>> Check the config system. A simple properties file isn't even close.
>
> I have seen that you supply options by config.xml, but if I am frank I
> don't see why. I don't see any good feature in using dynamic config file
> for static options. If you had real plugin features this might come
> handy, but not in the way you have done this.
Try adding a new configuration option to the Swing GUI, and potentially
to a web/other ui, simply by adding 5 or so lines to a config file, then
you'll see why.
And it does this without having masses of cross-dependencies between the
config system and the rest of the code. We could rip out and replace
either without disturbing the other.
Joe.