Profile cover photo
Profile photo
Arthur Kepler
Public/Professional Google+ Profile
Public/Professional Google+ Profile


Post has attachment
Snowshoeing in the Cascades!
Add a comment...

Post has shared content
My 2015 Middle East trip, with friends from Colorado.
Vancouver; Frankfurt; Tel Aviv; Haifa; Tel Megiddo; Dead Sea; Taba, Egypt; Petra, Jordan; and Jerusalem!
Middle East 2015
332 Photos - View album
Add a comment...

Killing HTML

Much to my delight as a programmer, APIs have been slowly abandoning XML in favor of a much more parsimonious data format: JSON. Of course XML is still fairly ubiquitous, especially in the life of a Java developer, even if it's reign over APIs has been challenged in recent years. Most API developers and API consumers surely appreciate this shift, if only for the simple reason of readability (the value of readability is hard to overstate!). And with such wonderful JSON libraries like Google's GSON, working with JSON APIs is a dream. JSON can also be parsed in a single real-world Regular Expression[⁰]! Attempting that with XML causes much weeping and gnashing of teeth[¹].

So, it occurs to me, if XML is so [justly] reviled as being garrulous, cumbersome, and bloated, why is the very foundation of the Web itself, still written in a subset of XML? Of course I'm referring to HTML, which serves its purpose well enough, but could be “upgraded” by JSON itself. Consider also that JSON is already a fundamental piece of web programming, serving as the native data format of JavaScript—hence JavaScript Object Notation! If done right, native documents in JSON, should dramatically simplify the ways in which both the browser internals and the web developer work with the DOM—currently a delicate process requiring careful respect for non-obvious details, library overhead, etc. I can imagine that front-end templating and partial embedding would move the accessibility of web programming forward a bit. Perhaps the praiseworthy but unrealized dream of the Semantic Web[²] would benefit from the key-value nature of JSON. More thoughts on that in a later post though…

If kids exploring web development, like 13 year-old-me on GeoCities, are presented with a drastically easier-to-read format, they'll catch on faster, especially when they pick up JavaScript. I suspect web development is most kids' introduction to programming overall, and we need to encourage more kids to program.

Seemingly, this could enable better tools and editors that generate, maintain, and test web applications. Natively exporting or importing partial JSON objects, from a backend service or a third-party, as nested modules within a larger document can push the web forward in interesting ways, relative to awkward iframes and DOM manipulation. Live partials in the context of a static document also have important performance benefits. This is essentially what Facebook has done with their BigPipe JavaScript library[³].

Interestingly, Google Chrome's developers have launched an initiative to port much of Blink, Chrome's new engine, to native JavaScript. A fascinating but challenging project to be sure! JSON DOMs would fit hand-and-glove with such a browser engine.

Hacking a fork of Chromium to demonstrate this will make for a fun project, although it's probably going to take a while (but I have enjoyed digging into its labyrinthine internals! What a way to dust off my C++). I did however create a tiny JavaScript library to build DOM elements using a sample JSON document. Here's the project: excalq/ on Github[⁴] and the demo on JSFiddle[⁵].

Add a comment...

Welcome to my new public Google+ Profile!

I plan on this profile featuring interesting ideas, articles, and essays about things I find interesting and professionally relevant. The topics which I plan to post about include software, the environment, science, linguistics, and a little bit of politics & economics.
Add a comment...
Wait while more posts are being loaded