I pondered the configuration files and their relationship to the code for a while, and depending on the day and direction of the wind, my opinions seem to change. More and more, although I keep returning to the awareness that I had when learning Lisp: there are few differences between data and code. In configuration files, this looks doubly. When I looked at the right light, the Perl script is slightly larger than the configuration file for perl. This, as a rule, has rather serious consequences for tasks such as QA and labor departments, for example, who should be responsible for changing configuration files.
Creep from a configuration file into a full-fledged language is usually slow and, apparently, due to the desire to have a common system. Most projects seem to start with small configuration items, such as where to write logs, where to look for data, usernames and passwords, etc. But then they begin to grow: functions begin to be turned on or off, the time and order of operations begin to be controlled, and, inevitably, someone wants to start adding logic to it (for example, use 10 if the machine is X and 15 if the machine is Y) . At some point, the configuration file becomes a domain-specific language and is poorly written.
Now that I’ve been on stage, here are my questions:
- What is the true purpose of the file configuration?
- Should I try to keep the configuration files simple?
- Who should be responsible for changes in them (developers, users, administrators, etc.)?
- If they are under source control (see question 3)?
As I said, my answers to these questions are constantly changing, but now I think:
- to allow non programmers to change large pieces of behavior quickly
- yes, everything that is not coarse grainy should be in code
- users should be responsible for the configuration files, and programmers should be responsible for the configuration layer between the configuration files and the code, which gives finer-grained control of the application
- no, but the finer middle layer should be
programming-languages config configuration configuration-files
Chas. Owens Mar 15 '09 at 18:07 2009-03-15 18:07
source share