by userbinator · 2y ago · 0 comments
Two days ago I was watching the election results on various sites, along with many others. Some sites just didn't work in a slightly older browser, and those which did were still consuming a lot more resources than they really needed. It shouldn't require the latest in web technologies and computing hardware to show a simple dynamically updating outline map.
If the service I'm using is hosted on us-east-1, it's using power from virginia, which uses a mix of natural gas and nuclear. [1]
Based on that... is running more logic on my computer or on an edge server within Québec, actually using less GHG-emitting energy than running it on the origin server?
[0] https://www.cer-rec.gc.ca/en/data-analysis/energy-markets/pr...
[1] https://en.wikipedia.org/wiki/List_of_power_stations_in_Virg...
I think the tools we have nowadays are perfectly fine. It's a matter of how they are used. And I am pretty sure efficiency is not what companies think of when they launch a product.
You can write Java without using incredibly huge class, function, and variable names. You don't have to apply complex design patterns everywhere, or use a complicated framework you barely understand. You don't have to write code that produces 50-line stack traces. I don't have to import a dozen dependencies each with a dozen dependencies of their own, creating an endless security update treadmill. You don't have to write code that needs a gigabyte of RAM for the smallest microservice. Problems like long garbage collection pauses can be solved.
But if I take a job writing Java software? Probably I'm going to be handed a codebase written the way most Java developers write Java code. And I'd better make peace with that, or find a different job.
I think this is not how companies work though, because they do not operate based on your views alone. And getting all people to agree on some of the topics you mentioned (e.g. importing dependencies vs. rolling your own implementations) is an incredibly complex task.
Yes, it doesn't have to be that time frame, but it would be a good reference point. Early 2000s allowed us to do most of what we can now, there are certainly exceptions, but the average website would be no worse. The savings in processing and memory consumption can then either be used to run other things, or extend the usable lifetime of a device. There's no reason why we could not use the same device for 10 or more years, again with some specialised exceptions.
Give that this is specifically a w3.org SIG, I'd suggest doing a LTS web standard, something like 10 - 15 years. Make it have a reduced feature set in terms of Javascript and CSS. For some businesses it would be attractive to know that a solution developed to a specific standard which would mean compatibility across devices and software for 10 years (ideally more, 10 years isn't that long). Newer devices would consume less power and older devices would require less frequent replacement.
The problem is that this would need to find it's way into a browser, which would also need a long term supported and stable operating system, to gain all the benefits.
As to HTML + CSS: it goes other way around: HTML and CSS (or rather its subsets) are being integrated into "normal languages", like Qt, Java. I'm not sure I ever saw any technology that could serve as a replacement for HTML + CSS. May be Eclipse RAP or Blazor? But they are so heavy that React will look like a butterfly and they're not aiming to replace HTML/CSS but rather just use it as output medium for their UI.
Yeah that kind of stuff is closer but most of those types of frameworks seem to lean heavily on mapping to JS because they try to be turing complete rather than just being easy to work with DSLs.
- Browsers don't "talk" any other language but JS
- All browser APIs are exposed through JS only
- You can't manipulate DOM except through JS
- You can't do "fancy web flourish" without manipulating DOM. If you target Canvas/WebGL/WebGPU, you'd have to first create your entire graphics lib + flourish + font handling and rendering + accessibility + ... from scratch. And load all that on every page load
- Any language compiling into WASM would still need JS-integration for any of the above. Including Canvas/WebGL/WebGPU
- Any language without JS and DOM semantics will need to account for that (e.g. GC on DOM nodes)
- Any language compiling to WASM would need to load its runtime to actually run (including any libs). See network tab for any such project. e.g. Blazor
I'm not looking for browsers to talk with any language. I'm looking for some DSL that directly maps to the 3 layout languages that browsers understand (i.e. HTML + CSS + SVG). Not anything turing complete at runtime but rather a sane way of describing a webpage layout with fancy styling, UI elements, transitions, and animations but without dealing with the pain that comes with actually writing in the native browser layout languages.
> You can't do "fancy web flourish" without manipulating DOM.
There is a lot of web flourish you can do without manipulating the DOM. It's not actually terribly unperformant to do but writing that code (mostly HTML + CSS, occasionally SVG) feels like peeling your eyelids with an unwashed lemon zester.
> ...
And for the rest of that, again I'm not looking for anything that actually executes in the browser. Just a sane, modern layout language that compiles down to static HTML and CSS with no JS or WASM (unless you explicitly ask for it).
Depends on what you mean by sane modern layout :)
Many modern layouts are still impossible without a lot of JS intervention. Many web flourishes also require Javascript :)
That's why there are no DSLs for this: HTML and CSS already are the DSLs you're looking for.
My gut feeling is that you cannot (fully) abstract away HTML/CSS if you want the result to feel like an actual website.
With Astro, MkDocs or docfx, I do not have to touch HTML, except maybe for creating the master layout and/or transformation rules, if needed.
JS crypto miners working overtime. Will allow CNN/MSNBC/Fox/etc. to stay in business for another 4 years.
(Along with Ozempic ads, which are basically completely unnecessary now.)
HTMX. Or basically we need some JS framework like HTMX / Alpine.js where we could test what to include in HTML.