Re:Configuration files suck. Just use a programming language
by krapp on Sunday July 27, 2014 @04:47PM
(#8093925)
You can pick up the syntax of JSON, INI and YAML in a couple of minutes - which is how it should be. Because all you should be doing with a config file is assigning values to variables or defining the attributes of a structure - and preferably, those values should be primitives. To me, "Turing complete configuration" is a contradiction in terms, or at least it should be considered such. Almost everything the author lists as an advantage of using a programming language shouldn't be done with configuration anyway.
One of the reasons I like PHP is that INI and JSON parsing come out of the box, so no need to worry about whether or not a packaged parser is compliant. This is also one of the reasons why I avoid YAML even though it's more flexible - if a configuration format isn't supported natively by the language you're using then I would agree it's probably an unnecessary layer of abstraction. But I don't see how the c example provided is much better than the .conf file, although it does possibly demonstrate that the config file format itself should be a bit less opaque. At least I can expect that a simple config file couldn't eventually explode in algorithmic complexity into its own bloated universe of code.
Keep it simple. Keep it stupid. You'll be thankful a few years down the road when the inevitable feature creep hasn't caused your config workflow to explode into its own self-contained application with its own dependencies and peculiarities.
One of the reasons I like PHP is that INI and JSON parsing come out of the box, so no need to worry about whether or not a packaged parser is compliant. This is also one of the reasons why I avoid YAML even though it's more flexible - if a configuration format isn't supported natively by the language you're using then I would agree it's probably an unnecessary layer of abstraction. But I don't see how the c example provided is much better than the .conf file, although it does possibly demonstrate that the config file format itself should be a bit less opaque. At least I can expect that a simple config file couldn't eventually explode in algorithmic complexity into its own bloated universe of code.
Keep it simple. Keep it stupid. You'll be thankful a few years down the road when the inevitable feature creep hasn't caused your config workflow to explode into its own self-contained application with its own dependencies and peculiarities.