I was lying in bed this Sunday morning, checking the Net before coming downstairs to make scrambled eggs (with mushrooms and snap peas, yum) for the family, and ran across a bit of random snark from Aaron Swartz. Any Sunday morning is improved by a chance to argue about markup languages and how the Web works.

Aaron tweeted: “@timbray Hey, check this out: http://abcnews.go.com/m/story?id=8129947 Oh wait, you can't, because you broke Postel's Law. http://yfrog.com/nxalujjj

At this point, if you don’t know what the argument is about, you can stop reading; it’d take a long time to explain, especially what with Mark Pilgrim having taken his toys and gone home.

In response to Aaron, I observe the following:

  1. That page displays just fine on my Nexus S and Galaxy Tab 10.1. Get a better phone.

  2. Seriously, ABC News? Not knowing much about them, I dropped by their front page. Feaugh. Get a better news source.

  3. I said:
    curl -I http://abcnews.go.com/m/story?id=8129947

    abcnews.com said, among other things:
    Content-Type: text/html;charset=UTF-8

    I looked puzzled.

  4. I poked around some more and discovered that Aaron’s problem turned up on my Galaxy Nexus. So I found its User-Agent string (which BTW is horrible) and added that to the curl incantation. abcnews.com said, among other things:
    Content-Type: application/xhtml+xml;charset=UTF-8

    I said: “Ha ha ha.”

  5. The text you are now reading is well-formed XHTML, served as text/html. I sort of see that as a practical application of Postel’s law.

  6. You might argue that Postel’s law means that data formats with strict syntax rules are inherently broken. Oh wait, check JSONObject and Jackson and so on; while we appreciate Crockford’s polite nod in Postel’s direction, JSON parsing in the real world is de-facto <gasp> Draconian, and appropriately so.

  7. Hey, it’s early Sunday morning. Go back to bed with your sweetie; get up in a couple of hours and play outside or watch a football game or something.



Contributions

Comment feed for ongoing:Comments feed

From: ebenezer (Nov 27 2011, at 11:10)

I am confused.

“That page displays just fine on my Nexus S and Galaxy Tab 10.1. Get a better phone.”

[…]

“I poked around some more and discovered that Aaron’s problem turned up on my Galaxy Nexus.”

Am I to understand that the S is “a better phone” than the Nexus?

[link]

From: Maxx Daymon (Nov 27 2011, at 11:29)

How is it that there is a Theory of Relativity and a Theory of Evolution, but every time a computer "scientist" has an idea it is suddenly a "law"? (Oh, it's because computer "science" *isn't*.)

I am pondering a test of Postel's "Law" against compilers. I wonder how difficult it would be writing software against non-deterministic compilers. Has even Postel's "law" been tested against TCP itself, by allowing mildly trained humans to attempt to write raw packets in whatever way they *think* makes sense? I doubt even TCP would hold up if people wrote their own packets.

I also wonder how much further advanced web technologies might be if the bulk of a browser's rendering code wasn't dedicated to attempting to second guess formatting intentions over a decade of HTML noise. Going with the Postel's law theory,

[link]

From: Liam Quin (Nov 27 2011, at 12:09)

There are, of course, two sides to Postel's law.

If browsers need to be liberal and display whatever they receive, there's a similar onus on Web servers not to serve broken content.

If the HTTP servers weren't so far out of spec, serving up HTML with errors, XML with errors, XML as HTML, JPEGs as XML, HTML as plain text... (I've seen all of those)... a whole lot of interop problems would indeed be solved or greatly reduced.

Of course, JSON, as you point out, is "draconian" (depending on how it's evaluated - if you use eval() it's not draconian, simply terribly insecure). Other draconian languages include C, C++, PHP, SQL, Java, the list goes on and on. I've used a C compiler that could recover from syntax errors, e.g. inserting a missed { or }, and it did give clarer error messages, but it didn't generate code if it did a correction, and I think not many people would want it to!

[link]

From: ben (Nov 27 2011, at 15:12)

On an almost-daily basis, I plough through other people's assets and discover YET AGAIN that to most, markup is imperative, not declarative. It rarely occurs to folks that %foo% descending from %bar% can by all means represent something different (albeit intuitively related, I hope) than %foo% descending from the root element alone.

(...And this is where I put myself wholly on record as believing that HTML5 takes the virtue of declarative-ness entirely too far.)

If compiled languages are like Mindstorms toys, and scripting languages like regular ol' Legos, then markup languages are like Duplo blocks: they get handed down to a less-clueful relative the split-second the user has demonstrated dexterity and ability adequate to the smaller, more complcated toys.

(Fifteen years of being told that the languages I work with every day are lightweight... has built up a bit of a chip on my shoulder. What? Didn't notice?)

("And I'd like YOU to turn that basket of tools into something that's actually USABLE by HUMAN BEINGS," I think to myself.)

In effect, people build tools that break XML, or allow it to be broken, because they're caught up in the "how" and not the "why" of the tool they're building.

(...Then again, "how" is the whole point to being an engineer.)

My point is that markup NEEDS some hard-and-fast rules to underpin its purpose of description... and beyond that, "liberal in what you send" is nearly an afterthought. When most of your programmers and other techs are busy forcing markup to put certain pixels in certain places, our current steaming heap is the result.

[link]

From: chris mahan (Nov 27 2011, at 22:14)

funny, the yfrog link for patel's law shows a yfrog menu bar over the image so I can't read patel's law. Htc incredible android smartphone thing, not rooted, latest updates.

[link]

From: len (Nov 28 2011, at 17:17)

Sort of glad I am exploring the mysteries of system.xml to broker xml among applications that can't see the web or even need it. Improving the odds we get to spend the weekend at home instead of work one VB class at a time. :)

MIL tech doc publishing: the redoubt of the XML Luddite.

[link]

From: John Hoyland (Nov 29 2011, at 08:06)

I know this post is snark in response to snark, but in light of my current concerns about Android, the "Get a better phone" comment is worrying. It just adds to the feeling that any device over 12 months old is considered obsolete by you Google Android folks.

[link]

author · Dad · software · colophon · rights
picture of the day
November 27, 2011
· Technology (81 fragments)
· · Web (388 more)
· · XML (135 more)

By .

I am an employee
of Amazon.com, but
the opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.