Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: You can reinvent browser UI technologies, what would you do differently?
12 points by osrec on May 26, 2021 | hide | past | favorite | 17 comments
A lot of people criticise websites for not sticking to simple HTML and CSS. They vehemently refuse to allow JavaScript.

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!




I would love to see a SwiftUI-type system implemented at some point. Not in-place of HTML/CSS/JS (that is probably impossible at this point), but I think it would be pretty awesome both to use and to develop with.


Interesting - what is it about SwiftUI that you like?


I feel like it would be easier to keep code looking clean etc. It also would be easier for newer devs to learn/use if they could do something like the right-click style edit that Xcode has.


Your second point sounds like it's already covered. Right click, inspect element, change the styles to whatever you want.


Databinding should be built into HTML/the DOM.

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 <dialog> [1], exist only to be made dynamic with JavaScript. Imagine being able to leverage all of these with nothing but markup.

There are a number of reasons this would be hard to add on at this point (though I don't think it's impossible!), but I believe it would have resulted in a web that's an order of magnitude lighter and simpler.

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/di...


I don't know if it's CSS or me but I never "got" CSS. I feel like it's more about remembering lots of unrelated things with no real clear logic behind it. An IDE helps a bit. Maybe if it was presented as a series of functions instead of properties, that takes certains types of variables? At least you could group some knowledge this way. Like height would take an union type like Pixels | Rem | Em | Percents | etc

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.


CSS actually does have functions. ‘linear-gradient()’ is one that returns a background image. You also have the choice of interacting with your style sheets via the css object model similar to the way you interact with the DOM, this is the basis of most css in js tech.

If you can’t tell, I’m a CSS shill.


I believe CSS had original prototypes that supported programmatic styling which had to be scrapped due to resource constraints on PCs at the time.


I always liked tools like Glade for GTK or Qt Designer where you design your application with a GUI in a WYSIWYG fashion, producing an XML file.

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/


I would have allowed HTML to actually mark up hypertext, you know... annotation. You shouldn't have to be able to write to a page in order to mark it up, just specify its URL, and layer on top of it.

Provide a way for linking to multiple URLs with a single link, to provide backups.


> 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?

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.


If the default dev experience was along the same lines as Flutter, I'd be happy. Same language, same tooling, etc. It's such a nice experience.


Make HTML a strict subset of XML... (I know it's been tried before but it might work if it were like that from the start)


I've always hated CSS.

Not sure best way to fix or remagine

Maybe just forget the first 20 years existed


Separate layout from styling. An event driven programming language


IMO the web today is kind of like a shared OS that desktops/smartphones/even consoles can access, and a data transit system that everything can access. And I really like this.

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.


Well actually reinventing the web seems quite unlikely but WebAssembly[1] seems to get a lot of the things you want, however some JavaScript is still required.

[1] https://webassembly.org/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: