Robin Berjon

XML Bad Practices

No Versioning Strategy

Versioning languages is hard, and there are many ways of getting it wrong. There is not room enough here to go into a full discussion of versioning, but suffice it to say that not thinking about it in version 1 will be the cause of many headaches in version 2. And there always is a version 2.

It is, of course, difficult to predict the many directions in which a language may evolve, and there are cases in which a given evolution of a language will require changes so radical that making it compatible with older content will be a bad idea. It is not those cases that one needs to worry about as they will be easy enough to address by creating something entirely new (which, for XML languages, leads to a new namespace). What language designers need to focus on is the next dot release.

When a language is being created it often starts with a big brainstorm of all the features that it could support, which are then trimmed down to the smallest number of features that will make it useful (the latter phase is, sadly, too often overlooked). A good exercise to try out to see if a language one is designing is ready for evolution is to start with a typical v1 document, and then start adding made up markup corresponding to what it would look like if it made use of all the features that were pushed off for version 2. The question then is: will that document still be processed exactly the same way as the unadorned document in a version 1 processor? If not, and if the intent is not to throw up unless everything is understood, then you have effectively painted the language into a corner.

If the intent is that x.n+1 should roughly work with a little loss in x.n implementations, you will need a versioning strategy. It's your language, with its own specificities, therefore no one can define this strategy for you. Two good places to start are looking at lacunae values and language-level error handling. Beyond that, the TAG is confidently expected to produce a set of good practices on this topic as part of issue XMLVersioning-41 at some point in the XXIst century.

This article is part of a series on XML Bad Practices.