As Mark Pilgrim is fond of saying, “There are no exceptions to Postel’s Law.” (Postel’s Law is generally quoted as “be liberal in what you accept and conservative in what you put out” or something to that effect.) The message of the law is that interoperability is the primary concern, and that programs should accept things, even things that are against the spec, if necessary to achieve interoperability.

HTML, as you may know, is a mess. It’s contorted in a hundred different ways with tons of bugs and their work-arounds encrusted into the Web and browsers are expected to make sense of all of it. The XML people saw this and said “we have to fix this”. Their solution was to break Postel’s Law.

With XML you are supposed to die and never look back if the document you come across violates the spec. The idea was that if everything died on invalid feeds, no one would ever write them. This is wrong for three reasons:

  1. Even with the rule, there will be invalid documents. Someone will write some code, test it, see that it works and move on. One day the code will be given data that trips one of XML’s exceptions (AT&T is a common example — XML requires it be written AT&T) and an invalid document will be created.
  2. XML apps compete for users. Users want to read these documents, even if they’re broken. Users will switch to apps that read these documents and the rule will be useless, since folks will likely test with those apps. The only way we can keep the rule in effect is by getting everyone who writes an app to act against the wishes of their users, which seems like a bad idea.
  3. Essentially the same effect can be achieved by having a validation display (like iCab or Straw’s smiley face that frowns on invalid documents) and an easy-to-use validator.

This is not to say that all apps should have to process invalid documents, or that they should work hard to guess what the author meant, or that we should encourage or tolerate invalid documents. We should try still try to get rid of invalid documents, but taking things out on the users is the wrong way to do it.

The creators of XML were wrong. Postel’s Law has no exceptions.

posted August 18, 2003 09:21 PM (Technology) #

Nearby

Dodging Trains
Super Searching
Letter from Knuth
Privacy, Accuracy, Security: Pick Two
Live from victoria.bc.ca
Postel’s Law Has No Exceptions
Canadians Do It Right
Secrets of Standards
Day, Today
The Biggest News
What A Little Bug Can Do

Aaron Swartz (me@aaronsw.com)