A lot of people criticise HTML for being terrible at defining layouts.
Given that the web is not just for text and images, but more of an app delivery platform, how would you alter the current state of HTML/CSS/JS to make it better and simpler?
Or perhaps you think it's great as it is, and any alternative would have equivalent drawbacks?
Interested to hear your thoughts!
Virtual DOMs wouldn't need to exist at all; things would perform better and also be standardized around one API for declarative updates. Even many apps out there could be made with vanilla JS (or in some cases, no JS at all). And the libraries/frameworks that did emerge would be much smaller and also compatible. You don't have to convert your utility JS when you move it to a project with a different framework; why should you have to convert your markup?
Think about all the native HTML elements that exist out there. Some of them, like
I think JS (ES5+) is mostly fine, a bit of legacy cruft but it's often overstated. I'd like it if we didn't need something as complex as Typescript to fully type it, but that may just be my biais for ML-style languages. Also, Reason/Rescript/Bucklescript/whatever spent its complexity budget on branding, which is a weird choice.
HTML I'm mostly fine with it, but I'd like to see what people could do by starting from the beginning with it.
I don't know anything about GUI programming outside of the web (and Win/Webdev) so my vision is really limited here.
Then connect the elements (widgets) to the signal handlers in your programming language of choice.
Now, you can even customize the style of your widgets through CSS.
The current state of web development only lacks that graphical editor, instead of XML/CSS/whatever you have HTML/CSS/JS.
With CSS frameworks like Bulma[1], Bootstrap[2], Tailwind[3], or component frameworks like Quasar[4], Vuetify[5], etc... I think one could develop a "No-Code" IDE to design GUIs. We'll get there in a few years for sure.
There may already be some project like this[6].
[1] - https://bulma.io
[2] - https://getbootstrap.com
[3] - https://tailwindcss.com
[4] - https://quasar.dev
[5] - https://vuetifyjs.com
[6] - https://bootstrapstudio.io/
Provide a way for linking to multiple URLs with a single link, to provide backups.
It seems there are two significantly different tasks - documents and apps. HTML was mostly designed for documents, and it suits them better. For apps the use of JavaScript is much more important, and the structure - and the intent of use - of the screen is very different.
Not sure best way to fix or remagine
Maybe just forget the first 20 years existed
Of course most webpages are just documents (e.g. blogs, threads), which only need HTML/CSS/minimal JS. But honestly, having the ability to just type in a URL from any device, anywhere, and get random data, or even a full application, is amazing.
Also, HTML/CSS/JS has evolved and added new features to fix a lot of what was originally bad design. And we have tons of libraries to fix essentially everything. You can write Kotlin.js/React/TailwindCSS and be programming in almost a completely different system.
But a big issue with the current web is all of the legacy content. Everything still has to be built on top of HTML/CSS/JavaScript, and most of their quirks from the old days still have to be supported. From my basic understanding of networks I also assume HTTP/TCP isn't ideal.
---
So if I could "reinvent" the web, I would make it a VM. Like what the JVM kind of tried to do. Although I would absolutely ensure that this is a security-first VM - optimizations (maybe of "trusted" bytecode) can come later, but first we need security over speed. Every site would basically be an executable.
But on top of that, there would be common languages and environments similar to HTML/CSS, React, etc. (of course hopefully improved), which compile into this bytecode. A compiler that creates bytecode which basically says "this is JSON (but actually a better, more compact version of JSON), here it is: 001000...)", and the VM would be designed so that this compiler is nearly instant, the data is compact, reading is nearly instant, since this would be common. A DSL and/or design app specialized for making blogs, another for forums, another for splash pages, etc.
And of course the web would evolve. We would probably get things wrong at first, so new languages / tools would come out later. Compiled "websites" would have a version number and the bytecode itself would upgrade, bytecode v4.0 would probably be a lot different than bytecode v1.0. Like how the web evolves now.
Except we'd be much better at "dropping" legacy features (since we can upgrade the bytecode OR tools), and have no more weird stuff to support. Hopefully we'd also have better tools for creating common websites than we have now, and these tools won't do weird things like e.g. simple blog posts with insane amounts of JS and polyfills.
Also a drawback is that bad code like malware and advertisements might be harder to spot, because it's bytecode not JavaScript. But honestly, JavaScript is already obfuscated and the code does weird things to hack / track you. And I need to reiterate, the VM would be security-first: potential dangerous or tracking operations would probably have special bytecodes or something to make them easy to spot, and they would need to request access which browsers could deny.
Anyways, that's my ambitious idea on how to reinvent the web. I'm sure something like that has / is being tried, lmk if you know something.