HTML — The Facade of Complexity
Understanding how HTML enables the intricate abilities of the modern web
The development community has seen a pretty recurring debate happening for the past 20+ years about whether HTML is a real programming language or not. I would like to propose that this debate is ridiculous. HTML is obviously not a programming language, it’s much more than that.
Or rather, a piece of much more. Nobody teaches you HTML in the void. You always need to pair it with at least CSS and usually JS drops pretty quickly into the conversation. Why is that back-end developers will mock HTML for being beneath them while failing spectacularly to build anything of significance with it?
What happens is that you make a neat little deal with the browser. In exchange for HTML, it will generate a document that can be read by a human being. Quickly arose from that:
The need to change how elements look, that’s CSS
The need to interact with the user’s actions, that’s JS
But no matter what happens on the JS side, you still modify the HTML or rather the DOM. In the end, HTML itself is simply a serialization of the browser’s current state. Which is an amazing abstraction. On one hand you have a living DOM that you can modify to reflect what you want to display. On the other, the CSS tells the browser how it’s supposed to look like.
From the developer’s point of view, you no longer need to worry about laying out and drawing components. From the browser’s point of view, it can organize itself to draw what it needs to in an optimal way — as opposed to a classic C++/Java/etc UI library, which is essentially bound to only react to instructions. Eventually most UI libraries came to this realization and developed their own declarative UI, like Qt with QtQuick or GTK with Clutter.
At first it was obviously very simple. All screens were 800x600px with a 1:1 pixel density and the web was thought as some kind of simple Word document. The table really turned in 2004 when Gmail proved you can have a full-fledged would-be desktop app running entirely in the browser. It has been a race to integrate as many abilities to the browser ever since, to the point where you can now talk to USB ports directly.
Which of course comes with a great deal of constraints. For starters, browsers run on different platforms and each platform has fundamentally different abilities. Then comes the security, because we can’t just give full access to unknown parties. And finally the goodwill of implementers, like when Safari took years to implement the file input. You could say that browser implementations come to an eventual consistency but the road is bumpy.
Given the current abilities of the Web Platform, what most people fail to realize is that the browser is akin to a new machine architecture — as in von Neumann architecture — that instead of being based on procedural instructions is rather directly reflecting its internal state to the user.
And just like regular computers which evolved from doing simple math until their current state with a galaxy of nuances in their abilities, the Web stands there with the same level of diversity. This is how HTML looks like an innocent simple thing which is in fact the facade of an extremely complex machine.
This author’s opinion on the matter is to stop splitting HTML, CSS and JS. They cannot be separated as they operate orthogonal aspects of the same machine, which is the Web Platform.