Expedients Should Be Temporary

I started out using YAML as the format for my Lump configuration file format, because I did not have anything specific in mind to use. YAML is easy to get started using. As long as the contents of the file conform to the YAML format, this is all it takes to get a single data structure containing all your configuration data into your program (in Ruby, the source language for Lump):

path =   File.dirname(__FILE__)
require 'yaml'

# more code here

config = YAML.load_file(path + '/lump.conf')

It's simple enough, and it gets the job done. The configuration data is even hierarchically arranged in config.

This does not mean all configuration data is well-suited to YAML compatible storage, however. For instance, the way lump.conf needs to be put together with its current philosophy of configuration management, I end up with code like this in Lump:

config['menu'].each do |a|
  print   %Q{        <li><a href="#{a[1]['url'].to_s}">}
  puts    a[0]['name'].to_s << '</a></li>'

I flinch at what appears, from this code, to be the inclusion of "magic numbers", namely the [0] and [1] parts of the code used to retrieve URLs and link names from config['menu']. I could probably figure out a better way to organize a YAML compatible data file so that this is not necessary, but it seems to be both a little too much work to bother and like effort to support using a data format that is not perfectly well suited to the task at hand, anyway. Far better, I think, to simply write a method or two of my own to use for the purpose of getting configuration data out of lump.conf.

I do not know when I will get around to tackling that task, but I have come to the conclusion that it is something I want to do at some point. I want my config file to not only provide for cleaner looking code within the Lump source file(s), but also to be more "intuitively" human-manageable and less dependent on a large third-party library.

Using YAML was an expedient, rather than a conscious and well-considered design decision. Eventually, I will need to think this through a bit more and make a decision I know to be appropriate to the design philosophy of Lump.