Skip to main content
102 votes
Accepted

How bad of an idea is it to use Python files as configuration files?

Using a scripting language in place of a config file looks great at first glance: you have the full power of that language available and can simply eval() or import it. In practice, there are a few ...
amon's user avatar
  • 134k
62 votes

SQL as a means of avoiding "releases"

Problem scenarios like these tend to suffer from a very confused train of thought that mixes ideas. In an attempt to answer this, I am going to have to systematically unravel all of the discrete ...
Flater's user avatar
  • 50.1k
54 votes

How bad of an idea is it to use Python files as configuration files?

+1 to everything in amon's answer. I'd like to add this: You'll regret using Python code as your configuration language the first time you want to import the same configuration from within code ...
Celada's user avatar
  • 654
36 votes

How can we avoid extremely complex configurations in enterprise software?

Why do companies making software sold to other companies tend to attempt to make the code general enough to meet the needs of all clients at the same time, while adapting the product to the needs of ...
candied_orange's user avatar
33 votes
Accepted

What Semantic Version increment to use for a filename change?

I think myprogram needs to release 1.1.0 which supports the myprog alias. If the user invokes myprogram then it should present a notice/warning to the programmer that this name will be deprecated in ...
MonkeyZeus's user avatar
24 votes

SQL as a means of avoiding "releases"

Monkey Patching It seems that the requirement from your boss is to have the ability to Monkey Patch the system while bypassing all other software development tools, processes and methodologies. Monkey ...
Ben Cottrell's user avatar
  • 11.8k
23 votes

How bad of an idea is it to use Python files as configuration files?

The other answers are already very good, I'll just bring my experience of real-world usage in a few projects. Pros They are mostly already spelled out: if you are in a Python program, parsing is a ...
Matteo Italia's user avatar
23 votes

How can we avoid extremely complex configurations in enterprise software?

Candied orange's answer makes a good job in explaining the economical motivation behind configurable systems in a quite metaphorical way. Still the main software engineering question remains, how we ...
Doc Brown's user avatar
  • 208k
16 votes
Accepted

In what configuration file format do regular expressions not need escaping?

CDATA sections in XML should do. Here's a stackoverflow post about it: https://stackoverflow.com/questions/2784183/what-does-cdata-in-xml-mean I remember it took me a while to understand how to use ...
Martin Maat's user avatar
  • 18.4k
15 votes

What Semantic Version increment to use for a filename change?

Since this is a backward incompatible API change, you should bump to 2.0.0. Changing the name of a command line program is backward incompatible because the name is part of the API, and scripts and ...
JacquesB's user avatar
  • 59.6k
13 votes

In what configuration file format do regular expressions not need escaping?

This is indeed an interesting question, as commonly the requirements for config file formats are somewhat different, so it's understandable that available formats don't really support this requirement....
Hans-Martin Mosner's user avatar
12 votes

Is it fine to trap users in a dialog until they enter valid values into components?

It's a fine goal to want your validation logic exist in only one place. It's not fine to take that as an excuse to give the user a lousy experience. You shouldn't "refuse the dialog to be closed&...
candied_orange's user avatar
12 votes

Should I configure my URLs with a leading and/or trailing slash?

Do not use bare strings to record URIs. Most languages have a type for them that handles joining absolute and relative paths automatically, ensuring you never need to sorry about doubled (or missing) ...
Jules's user avatar
  • 17.8k
12 votes
Accepted

Binary data formats, how to make ensure you can read different format versions?

It seems to me that the simplest solution is to make your version header unambiguous and make sure that the old format can never look like it has a format header, you simply look for it. If it's not ...
JimmyJames's user avatar
  • 27.3k
10 votes

Should I configure my URLs with a leading and/or trailing slash?

Always including a trailing slash on the base URL and omitting the leading slash on the relative URL would allow you to concatenate the two in a manner that matches the spec on combining a base URL ...
Josh Coady's user avatar
10 votes

In what configuration file format do regular expressions not need escaping?

Consider TOML It handles two different forms of raw strings: regex = '<\i\c*\s*>' OR regex2 = '''I [dw]on't need \d{2} apples'''
JimmyJames's user avatar
  • 27.3k
9 votes

What is the preferred way to store application configurations?

Many people criticize storing configuration in regular files together with your source code but in my experience, this is actually a pretty good solution: Simple to implement in any language. In many,...
Michał Kosmulski's user avatar
9 votes

How bad of an idea is it to use Python files as configuration files?

The main question is: do you want your configuration file to be in some Turing complete language (like Python is)? If you do want that, you might also consider embedding some other (Turing complete) ...
Basile Starynkevitch's user avatar
9 votes

Storing settings in a table in my SQLite database or separately?

I don't agree that storing settings in a database table is a bad separation of concerns. Your "concerns" will be separated by not defining a relationship between the settings table and other tables in ...
Bill the Lizard's user avatar
9 votes

Binary data formats, how to make ensure you can read different format versions?

Your old format starts with an 8-byte "size" element (probably a 64-bit long). If that's the file size in bytes (what I guess), it most probably never exceeded 100 GByte, meaning 2^37. So, if you ...
Ralf Kleberhoff's user avatar
9 votes
Accepted

Should a class be responsible for its own configuration

Both is not really great. The first version is slightly better, because it at least attempts to be able to inject something. The problem is, strings cannot be injected based on the name of the ...
nvoigt's user avatar
  • 8,014
8 votes
Accepted

The notion of configurable strategies

"As you can see above, each Strategy is optionally configurable through its constructor." This is perfectly fine/normal, and is in fact one of the cornerstones that makes polymorphic types ...
Filip Milovanović's user avatar
8 votes

What Semantic Version increment to use for a filename change?

The semantic versioning defines versioning rules solely in relation with the API, as it aims to facilitate the management of dependencies between packages. Regarding the command line you are in a grey ...
Christophe's user avatar
  • 77.3k
8 votes

SQL as a means of avoiding "releases"

That code is in stored procedures inside a SQL-based database does not excuse it from version control, version management, testing, and all the usual dance steps of software development. For ...
Pablo H's user avatar
  • 655
8 votes
Accepted

What are the benefits of configuration languages over just using the source language?

To perhaps state the obvious, configuration is a different activity than coding. In my experience, configuration is something that is applied at the point of deployment. For example, you might need ...
JimmyJames's user avatar
  • 27.3k
7 votes
Accepted

Should I use Lua for writing config files?

The needs for any language that you use for configuration files are the same, regardless of whether it is a programming language or not: The people who use it can do so reasonably effectively. If ...
Nicol Bolas's user avatar
  • 11.9k
7 votes

Binary data formats, how to make ensure you can read different format versions?

The convention format version ID, everything else is good because it gives maximum flexibility for the format. In your case the version ID isn't right at the front but at a fixed offset. This slightly ...
amon's user avatar
  • 134k
7 votes

How can we avoid extremely complex configurations in enterprise software?

A solution we've been using for a couple of decades now is to have complex ERP software with standard off-the-shelf configurations. The customer gets a lot less choice taking a pre-configured ...
it's a hire car baby's user avatar
6 votes

What is the preferred way to store application configurations?

We are battling the same problem where I work. Right now all of our configurations are file-based and source controlled with the individual applications that use them. This leads to duplication and to ...
ssjcory's user avatar
  • 61
6 votes
Accepted

What Semantic Version increment to use for a configuration file alteration?

If you need to distribute new copies of the software, then bump the patch version. Your changelog would be Changed default value of myTimeout configuration to 1000
Daenyth's user avatar
  • 8,127

Only top scored, non community-wiki answers of a minimum length are eligible