December 2006

December 13, 2006

Validation considered harmful

Filed under: semanticweb,webarch — Mark Baker @ 2:10 am

We don’t get a lot of enjoyment about trampling sacred cows here at Coactus, honest we don’t. But we see so much bad practice out there – more so recently – that we feel compelled to speak out.

Today’s sacred cow is document validation, such as is performed by technologies such as DTDs, and more recently XML Schema and RelaxNG.

Surprisingly though, we’re not picking on any one particular validation technology. XML Schema has been getting its fair share of bad press, and rightly so, but for different reasons than we’re going to talk about here. We believe that virtually all forms of validation, as commonly practiced, are harmful; an anathema to use at Web scale. Specifically, our argument is this;

Tests of validity which are a function of time make the independent evolution of software problematic.

Why? Consider the scenario of two parties on the Web which want to exchange a certain kind of document. Party A has an expensive support contract with BigDocCo that ensures that they’re always running the latest-and-greatest document processing software. But party B doesn’t, and so typically lags a few months behind. During one of those lags, a new version of the schema is released which relaxes an earlier stanza in the schema which constrained a certain field to the values “1”, “2”, or “3”; “4” is now a valid value. So, party A, with its new software, happily fires off a document to B as it often does, but this document includes the value “4” in that field. What happens? Of course B rejects it; it’s an invalid document, and an alert is raised with the human adminstrator, dramatically increasing the cost of document exchange. All because evolvability wasn’t baked in, because a schema was used in its default mode of operation; to restrict rather than permit.

Just because it only makes sense for a field in a document to contain the values “1”, “2”, or “3” today, does not necessarily mean “4”, “0”, or “9834” won’t be valid tomorrow. Similarly, just because a document doesn’t now contain a field named “Blarg”, it doesn’t mean it won’t later. A good rule of thumb in document design is to avoid making assumptions about what won’t be there in the future, and a rule of thumb for software is to defer checking extension fields or values until you can’t any longer.

On the Web, you need to be able to process messages from the future.

P.S. if you’re wondering what time-independent validity looks like, we’ll cover that at a later date (check the tags of this post for a hint).

• • •


  1. […] […]

    Pingback by Dare Obasanjo aka Carnage4Life - Versioning Does Not Make Validation Irrelevant — December 14, 2006 @ 10:57 pm
  2. […] Validation considered harmful (tags: XML validation schema rest by:mark_baker) […]

    Pingback by protocol7 » Blog Archive » links for 2006-12-15 — December 15, 2006 @ 8:19 am
  3. […] Mark Baker misses an important distinction in “Validation Considered Harmful” when he writes: […]

    Pingback by Marc de Graauw - Random Notes » Blog Archive » Validate for Machines, not Humans — December 22, 2006 @ 6:50 am
  4. Is Validation Harmful?

    This post is in response to Mark Baker’s post on Validation Considered Harmful. He is partly right about the harmfulness of validation in the specific use case discussed in his post, but I disagree with the generalization implied in his post. Whether…

    Trackback by — December 26, 2006 @ 1:52 pm
  5. […] Another way to look at the validation problem is through the eyes of a software architect. We’re often concerned about “encapsulation”, the practice of keeping related business logic and data together. That practice can take the form of “objects” in OO systems, or just through the partitioning of data and processing logic in non-OO systems. In either form, the value there is that maintainability is improved. […]

    Pingback by Integrate This»Blog Archive » Two more reasons why validation is still harmful — January 2, 2007 @ 12:55 am
  6. […] David Baron of Mozilla has chimed in on a topic near and dear to much of the work we do at Coactus. It looks like it’s part one of a series; I look forward to the rest. […]

    Pingback by Integrate This»Blog Archive » David Baron on versioning — March 25, 2007 @ 9:29 am
  7. […] messages from the future. Interesting post from Mark Baker about XML validation and web services: Validation considered harmful Share this:TwitterFacebookLike this:Like Loading… Search […]

    Pingback by Messages From the Future | Lost Boy — May 9, 2013 @ 7:35 am

Comments RSSTrackBack URI

Leave a comment

You must be logged in to post a comment.

Powered by: WordPress • Template by: Priss