Author Archives: Claude Vedovini

Choose Life

Choose Life. Choose a job. Choose a career. Choose a family. Choose a fucking big television, choose washing machines, cars, compact disc players and electrical tin openers. Choose good health, low cholesterol, and dental insurance. Choose fixed interest mortgage repayments. Choose a starter home. Choose your friends. Choose leisurewear and matching luggage. Choose a three-piece suite on hire purchase in a range of fucking fabrics. Choose DIY and wondering who the fuck you are on Sunday morning. Choose sitting on that couch watching mind-numbing, spirit-crushing game shows, stuffing fucking junk food into your mouth. Choose rotting away at the end of it all, pissing your last in a miserable home, nothing more than an embarrassment to the selfish, fucked up brats you spawned to replace yourselves. Choose your future. Choose life… But why would I want to do a thing like that? I chose not to choose life. I chose somethin’ else. And the reasons? There are no reasons. Who needs reasons when you’ve got heroin?

Mark “Rent-boy” Renton.

What will you offer your kids for Christmas?

I don’t have kids but for Christmas I will buy an OLPC (One Laptop Per Child) and enable a kid, somewhere, to get one.

Go to Amazon on November the 17th and buy your kids one, it’s less expensive than an Eee PC ($399) and you will buy yourself good Karma.

And it appears that even some adults may like to receive an OLPC for Christmas ;)

XML schemas compatibility

Photo by psd

This is the fourth installment of this series about managing backward compatibility in software development. Here I talk about what makes an XML Schema backward incompatible.

I specifically address W3C XML Schemas but general principles applies regardless of the schema language you use.

But first, why bother about XML Schemas compatiblility?

Actually, in enterprise applications, XML is often used either to specify configuration files or interchange formats. With the rise of WebServices and RESTFull applications on the Internet there is also an increase in the use of XML.

Thus, making sure that existing configuration files still work with your new software or, more importantly,  that other applications can still communicate with yours can really make a difference.

So, what makes a schema incompatible?

  • Changing an element or attribute type to a more restricted type (like adding constraints on a xs:string)
  • Changing the order of a sequence in a complex element
  • Removing or renaming an element or attribute from a complex type
  • Adding a mandatory element or attribute to a complex type without providing a default

Removing complex or simple types will also make it incompatible if:

  • Your schema is included or imported by other schemas or
  • You do not replace them by compatible anonymous types (compatible meaning equivalent or less strict, e.g. if one defines a simple type JavaClass, which is a xs:string with a constraint, and replaces it with xs:string).

Then, how to preserve backward compatibility?

If some elements of the schema are becoming obsolete, do not remove them. Instead, mark them as deprecated in the schema documentation and, if applicable, remove their mapping to the object model (that way you will not have to maintain the code equivalent of the deprecated elements).

The best strategy I came across so far is using namespacing: If a given schema must be refactored, create a new one, changing its namespace (a good practice is to include the major version of the schema in the namespace).

You then have two options:

  1. provide an XSL stylesheet that enables the migration of XML documents from the old schema the new one
  2. provide support code to be able to read both document structures

Of course, the second solution is the most desirable from the operational point of view (and the first one is not always applicable). However, the trade-off is that it is more expensive from the development point of view. Once again, choosing between who is going to do the work (the guy who develops or the guy who installs your application) is a matter of project management.