I'm planning to redesign and rewrite my ESMS project, and one of the most important issues a redesign of its configuration files.

Like virtually every project created by newbie programmers, ESMS is a museum of home-brewn configuration file formats. The three major configuration files the program uses are all different - one resembling INI files, another a curious attempt at templating (using printf-like format strings), and the third completely free style.

So, it's time to something a bit more standartized. A standard file format (like XML) has three main benefits:

  1. It is far simpler to read into the program, without the need for custom-format-reading code.
  2. It is also simpler to generate, for the same reason as (1)
  3. Since it's standard, at least some users are already familiar with it - and third party tools for editing / viewing exist

Until recently I was almost completely locked-in on XML, and even created a sample XML file for one of the configuration files. XML is a bit too verbose, however, so I decided to look into YAML as well.

YAML is gaining popularity in the domain of dynamic languages (Perl, Ruby, Python), for which it was originally intended. It is mainly suited to serve as a serialization format for data structures, but can be used for general-purpose data file tasks. Here are some useful links for YAML:

For my purposes, YAML seems to have one serious benefit over XML: it is cleaner. The syntax is far less cluttered and far less repetitive - lists of entries don't have to repeat the entry name, for instance. XML, however, has benefits as well: first, it's more familiar, and second, it can be verified very easily even by n00b users. It is a curious fact that although I'd assume YAML would be more compact space-wise, it actually isn't because of the indentation significance and the ban of tabs.

The second reason in favor of XML is worth elaborating: my users mostly aren't computer experts, they are just simple users who want to run a few fantasy football games with their friends. To use ESMS fully, one must edit the configuration files and fit it to his needs. While editing XML isn't ideal in terms of simplicity, YAML is worse, IMHO. A user who've edited the XML file and wants to see that it's well formed can just double click on it, firing up IE (or another web browser, but IE is usually default for .xml files) and see immediately if there are any syntactic mistakes. This can't be done with YAML.

I still haven't reached a conclusion on which format to choose, but I will :-)


Comments

comments powered by Disqus