Skip to content

Instantly share code, notes, and snippets.

@peterwwillis
Last active March 17, 2021 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterwwillis/4d38a41b2b7bc23816af7d5f653213fa to your computer and use it in GitHub Desktop.
Save peterwwillis/4d38a41b2b7bc23816af7d5f653213fa to your computer and use it in GitHub Desktop.
The difference between configuration formats, configuration languages, data formats, and programming languages

The difference between configuration formats, configuration languages, data formats, and programming languages

There is a lot of confusion out there about what different file formats are and how they are intended to be used. Having used a lot of them over the years, I think I can explain their differences, and when and how to use them.

Data formats

A data format is a file format for encoding data. Typically the format is structured to make it easier for machine interpreting & processing. It consists of a structure (or schema) of one or more data types, and may allow for specific data to be included which will trigger specific kinds of data processing.

Programming languages

A programming language is a formal language comprising a set of instructions.

General-purpose languages

These are programming languages that are used for many purposes (XML, UML, BASIC, C, Java, Python). They can be used for a wide variety of tasks and are not limited in their use cases.

Domain-specific languages

These are programming languages designed for a specific application or problem domain.


Configuration formats and languages

Configuration formats

A configuration format is a data format designed to assist in configuring an application or service. The format does not create new functionality, but merely instructs a program on what functionality should or should not be used, or what values should be used for various functions.

Configuration languages

A configuration language is a domain-specific programming language designed for a specific application or problem domain. They provide a formal language comprising a set of instructions in order to create configuration for an application or service.

Examples of configuration languages include Apache configuration (https://httpd.apache.org/docs/2.4/sections.html), Hashicorp Configuration Language (https://github.com/hashicorp/hcl), Puppet configuration language (https://puppet.com/docs/puppet/5.5/lang_summary.html) (https://puppet.com/blog/why-puppet-has-its-own-configuration-language/).

Declarative versus Imperative

Some configuration languages claim to be "declarative", while others do not ("imperative"). What does this mean?

A declarative language is a language for declarative programming. Declarative programs describe their desired results without explicitly listing commands or steps that must be performed.

Imperative languages list a specific set of steps or actions to perform in order to get to a desired end state.

Most configuration is only intended to give provide input to a function. The function takes this input and determines what actions to take and what the end state or output should be. As most configuration is not describing a specific end state, nor giving a list of instructions to perform to reach and end state, configuration is typically neither declarative nor imperative.

Some configuration languages are advertised as "declarative". But usually they are complicated enough languages that they can be used in a way that does not describe a desired end state, or that provides an order of instructions that must be followed to reach the desired end state. Thus, whether something is declarative or imperative should be evaluated on a case by case basis.

Blurred lines

Some applications use configuration that blurs the line between a data format and language, and it can be hard to tell which is which.

For example:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment