Did we fuck up the internet? part 2
I took a month from my last post to reflect on what the future of the internet might be. To recap, the internet is in a precarious state, from but not limited to the following:
- itās lost many of its great protectors
- itās being actively exploited as the ultimate propaganda machine
- itās frustrating and burning out its maintainers
The first and second problems are not only beyond my pay grade, theyāve been covered at length elsewhere. But I am here to speak on āfrustrating and burning out its maintainers.ā What better way to save the internet than to make its barrier to entry as low as possible?
In that vein, I think the internet is long overdue for a (realistic) reimagining. Keep in mind what follows is complete imagination; an utter shot in the dark. Assume HTTP and the underlying protocols all still exist, but what if we could reinvent the fragmented HTML/CSS/JS mega-ecosystem with all the server-side languages, frameworks, preprocessors, and bells and whistles that come with it? And if we did, could we make lives easier? Here are 4 ideas to make web dev more maintainable:
future 1: overhaul HTML
HTML was originally created to easily create rich documents. Problem is weāve been building highly-interactive web apps for years. And because of that disconnect, we have to build the same UI components, over, and over, and over (and over) again.
Although one solution to alleviate this sisyphean task would be to ditch HTML and the ādocumentā idea altogether, HTML is responsible for some of the most accessible interfaces weāve ever built. Screen readers and a suite of tools revolve around HTMLās design, so simply throwing it away would mean decades of setback for less-abled individuals.
What if we kept HTML, but made it do more out-of-the-box? What if instead of building the 5,672nd
multiselect in [framework of choice], we could instead add a <input type="multiselect" />
to the
page and be done? Or how many terrabytes of npm packages could be reduced if browsers shipped a
decent built-in <dialog>
?
āBut there IS <select multiple>
already!ā some will say. But I know youāve never used thatāand
only thatāto add that interaction to your site. It hasnāt worked for mobile devices in years. And I
know youāve never used an unstyled <input type="date">
to fully power your hotel or
airline-booking website. Googleāthe biggest advocate for the <dialog>
elementādoesnāt even use it
anymore in its Material Design for web.
āBut the Web Components spec!ā āBut HTML5 was designed to create custom interactions!ā Iām not saying that thereās been no reason, or thinking, that led us to where we are now. Iām simply disagreeing with it.
Look at how far native development has comeāboth iOS and Android have common UI that works, and works well. Why are the default HTML elements so garbage? And why is it impossible to style most of them?
how it will help
For web we spend so much time setting up projects, build tools, and remaking the same UI components as others with almost the exact same results, it feels like weāre all too tired by the time we get to the actual work. By having a much more usable set of UI components baked into the browser, we could more quickly create sites and content.
how to get there
We need a new community-oriented HTML spec that saves us from building the same UI elements over and
over and over again. And we need a new browser that supports all of these. We need all the 1300+
proposed elements not only to ship, not only to be stylable (looking at you,
<progress>
), but primarily to be usable without styling.
One better future for the internet is if politely, and with all due respect, the HTMLWG takes a seat while the community builds one central UI solution to serve the needs of the modern web. We can have it if we build it (and if you want to build it, contact me!).
future 2: bye bye browsers, hello native
JavaScript is hard. No, not because of the language design. Not because of the community. Itās hard in spite of the countless contributions from brilliant individuals who make it workable. Itās hard because to make a simple experience for users, one must wield HTML, CSS, and JS deftly to cobble togetherā¦ what? An experience that can be slow to load, bad for users, and was an absolute nightmare to assemble.
What if we ditched all that? What if, instead, we shipped experiences like apps in iOS or Android? Consider:
- Native apps have built-in offline mode (unlike the web, which requires complicated setups like service workers)
- Native apps have unmatched performance, being compiled rather than runtime scripts
- Native apps are more bandwidth-efficient since they donāt have to be redownloaded every time theyāre used
- Native apps can offer similar accessibility because more of the device can be used
- Native apps can offer a wider range of experiences, partly by way of being closer to the hardware; partly due to the increased performance.
I know Iām guilty here of comparing the best native apps to the average website, and thereās not a clear winner (I would be out of a job if that were the case!). The Web vs Native debate has been talked about ever since the arrival of the Apple App Store (arguably as a continuation of the classic desktop application vs web software debate). But Iām just saying I believe Native Apps conceptually make more sense than web for task-based applications.
Assume thereās a development environment that lets you build native applications for every target (for example, Flutter). Assume that one codebase could generate native clients for all major desktop and mobile OSs. Also assume there arises some open way to produce apps thatās not gatekept by a corporation like Apple or Google (like npm or GitHubāthough corporate entitiesā have fostered an open, community-powered marketplace where anything may be published for free).
Assuming all those roadblocks were removed, whatās stopping us?
how it will help
Much of JavaScript fatigue and the mountain of complexity comes from us fighting with the internetās original document model that we have outgrown, and abused to all hell to try and make rich interactive experiences. The weird place weāre in only came from a (very) winding path to where we are now. If we had to recreate web development based on our needs today, Iām convinced JavaScript wouldnāt be a part of it. So if we could start over and save everyoneās time, why donāt we?
how to get there
So the trade Iām proposing here is a vastly simpler web environment, and the next-generation of experiences. In exchange? We only need to give up the archaic yoke of browsers that have hindered progress. We employ a model to experiences similar to npm or GitHub, where experiences can not only be downloaded; they can be examined for security.
āThatāll never happen,ā some may say. But letās put a spin on the current reality for a bit: isnāt Google the only way you can use the internet today? Isnāt Google just a shittier app store in its current form? What if we could improve everything across the board? We could with native, if we solved the discovery and oversight problems.
future 3: jamstack, except it works
In possibly the least sci-fi future, we forge full ahead on the Jamstack (originally JavaScript, APIs, and MarkupāāJAMāāwhich has since been broadened), despite oppositions to it. This means that we double-down on our current bets that everything will work out, despite billions of dollars being sunk into all its inefficiencies, in the hopes that itāll get better. Why?
- Static Typing in JS: What if TypeScript became a part of the language spec? It would not only mean more reliable applications; it would also drastically simplify and speed up build tools
- ESM is now a thing: A huge point of complexity and headaches has been the CommonJS (Node) vs ES Modules divide. With Node.js and JavaScript (and Deno) all moving to one module system, it could change the web (weāre also betting on this with Skypack).
- WASM enters the mainstream: though WebAssembly didnāt change everything about the web on its release, doesnāt mean it isnāt slowly making strides. wasm-powered tools have been skyrocketing lately. Rust is the new darling of software. Arguably the biggest flaw in the webās design is demanding that JavaScript always be used for the client (even as a Node developer myself, I realize Node has limitations and canāt realistically power many servers). HTML and CSS aside, wouldnāt the web be much easier to build for if the client and server could be written in one language?
All of these are signs towards progress, but thereās one fatal, fatal flaw in this approach: server-side rendering. Browsers are designed to work best with JavaScript as an accessory; not as a foundation. HTML is still queen. Regardless of whether your site can get away with being a pure SPA, that wonāt cut it for the rest of the web.
how it will help
One could argue this is our current path, merely a projection. This makes the bet that itāll get even worse before it gets better in terms of complexity and knowledge required. But the payoff some, new, āholy grailā future framework that will make everyoneās lives easier.
how to get there
Several things need to fall in place to pay down the debt weāve been accumulating for a while. If we do decide that JS is the foundation, and not HTML, then we need build tooling that handles all of the above:
- Can turn JavaScript templates into static HTML easily (in any JavaScript solution, not just My Popular Frameworkā¢). Also it wouldnāt require Node.js.
- Doesnāt load any JS to the client if itās not needed.
- When JS does load to make the page interactive, it only re-renders the interactive parts, rather than blocking the main thread and hijacking everything in the browser.
- Doesnāt require agonizing compile times that cost time, money, and headaches.
While this the closest direction to the one weāre heading in, itās a humbling reminder that some of the biggest, hardest pieces have yet to fall in placeāmostly the SSR part. And itāll take a lot of work yet before the ābet on JSā has actually paid off.
future 4: a tale of two webs
Tom MacWrightās A clean start for the Web outlines a Document Web and an Application Web coexisting, a little like combining futures #1 and #2 above. While this is an idea that Iāve been thinking about for a while, I have to give Tom the credit, because he wrote it down and I didnāt (also he puts things into words better than me; why are you even reading my blog again? Go read his!).
So one could argue that this is either a migration or experiment towards an alternate future, but it may end up being a viable path for longer than Tom devotes space for in his blog post. In summary:
- Document web is for reading. Wikipedia, news, blogs, etc. Basically squarely inline with HTMLās original design.
- Application web is for everything else: mapping, shopping, games, entertainment. All the rich interactive experiences do back to native.
In this world, JavaScript plays a much-reduced role, or even goes away entirely. Browsers become more pure āreaders,ā centralized around delivering static content. Meanwhile, interactive experiences become richer and more widespread as thousands of web creatives finally make the leap to native development.
how it will help
This pays down the technical debt weāve been mired in for over a decade, by splitting apart concerns. This recognizes that the load weāve placed upon HTML, CSS, and JS has been too great for too long. But rather than force documents to live in native-land (solution #2), we give documents their own environment, perfect for them: Document Web. And all the āweb appā stuff we architect a new medium for.
how to get there
I think in this future, too, browsers go away (out of my predictions, thatās 3/4 futures, if youāre counting at home). Something browserlike will replace it, sure, but would be so reduced in purpose Iām not calling it a browser.
Similarly, we have the same stalemate as future #2 where there is no central service to deliver applications other than Appleās App Store and Googleās Android marketplace. What could that look like? What could an app āstandardā resemble? And could it be openly-governed?
we desperately need a new future
Above all else, we really need to change how we build the web not for ourselves, but for those who will come after us. The internet was architected to be a bastion of free speech and radical democracy, but that light has been fading for some time. I believe the central contributor to this is that only privileged, educated, wealthy individuals have been building on the web. And so, historically, the web has looked, sounded, and gatekept by these elite few.
Likely none of these will come to pass; likely each of these has a mountain of hidden complexity that is harder to overcome and contains more problems than our current system. But Iām a big believer in taking a step back, and looking what we have. And I believe that anyone that does this, honestly, canāt be satisfied with the web ecosystem weāve built for ourselves.
Being dissatisfied with the status quo of how the web is built isnāt just a good idea; itās necessary. We need it to change. This web development shit is difficult enough for experts with years of experience and education to pull off. Imagine how alienating and frustrating it must be for newcomers! And with all thatās going on in the world, we have never needed the internet to be less white, and less male, than it is now. But sadly, thatās not changing..
Reducing the complexity of the web isnāt just a ānice to haveā for our own sakes. Itās the very thing that will save our souls.