Settings API

Linux, Programming, Web

After creating several sites using several CMSes, one single thing still annoys me: the lack of a proper export settings feature. Puting a local testing site in the official online server is always a nightmare, since we have basically try one of the options:

  • Copy the whole database: it also copy several testing data we used.
  • Step-by-step replication: After 3 days, you will still discovery several options that were not copyed
  • Manually select DB table-by-table to copy: unless you really know of are you doing, its quite crazy

In Drupal world, one of my most admired companies, Development Seed, created both Features and Strong Arm that try to address this, but the lack of broad and ubiquitous support we still feel that we will miss something.

settings_api_content_2095

There are 3 types of data that a computer program might have:

  • External: the spreadsheet for Excel, html to a browser, the image for Photoshop… its the reason why the program exists.
  • Internal: the data that makes the program works. It’s the settings.
  • Temporary: stuff that the program creates in order to gain performance. It, by definition, dont need to be backed up because the program can recreate everything

Every program that is a platform should provide a Settings API. It would help on 4 big scenarios

Local / Production

There are several situations that we need to maintain a testing site for development new features without testing in the really production site. But time to time, we are satisfied with the test results and we and to apply the modification into the production site. For some business, like 3rd party site development, its the daily job, so its a must to make this workflow faster and painless.

Debug

After installing several plugins, its each to get a very unstable site, because they are changing same data. It would be much easier to monitor modifications and find solutions. A settings comparison tool would be great, so we could see what were overwritten.

Distribution / Template

Platforms, by definition, allow us to build stuff over it. But quite often projects are similar. So why not create a template for other people to use it? For a site builder like Drupal, we could create eCommerce, Blog, Forum templates for a easy deployment. Its an extraordinary feature for new comers.

settings_api_content_2096

Stack

If the program is settings aware, a good extra feature is to apply in a stack. Its a similar concept of CSS, cascading settings based on specific variables. Imagine, for example, a site about football teams. While the site has a main theme, each team’s page can have one and the users can have a personal one. We could enabled this cascaded settings for each settings.

Multi dimensional settings

If we have different content types in a site (ex: static pages, forum pages and news pages), we could have a page to change all settings related to each content type and have a page to change a specific settings of all content types.
As we can see, settings is a very important part in a program. We have to think it with more care to leverage its potentials.