News for hackers. Stuff that matters.
Re:Breaking up with JavaScript front ends by qrohlf on Saturday December 10, 2022 @01:31PM (#33935270)
Seems like a half-baked agency-built version of htmx[1], no?

I'm actually very intrigued by the whole "let's take a step back and move a lot of our logic back to the server" approach to modern dev, but IMO when you need more than statically rendered pages, it should look a lot more like htmx or Phoenix LiveView (if you're using a framework) or something ultra-minimal like Slimvoice[2] if you want to go the bespoke route. Not this.

[1] https://htmx.org/.

[2] https://javascript.works-hub.com/learn/a-javascript-free-fro.... https://slimvoice.co/

Re:Breaking up with JavaScript front ends by t8sr on Saturday December 10, 2022 @03:53PM (#33936682)
Alternatively, web developers could calm down and just write mostly HTML with some plain javascript where warranted.

I've recently done some web development for the first time in 12 years, and I was horrified at all these pointless frameworks that break every usability win web browsers have made in the past 20 years, cost extra bandwidth and have atrocious performance. Like, why? Can web devs really not learn the 4 functions that make up the websockets API? Do they really need a special framework named after a coffee bean?

This kinda crap is why the gmail tab uses a GB of memory.

Re:Breaking up with JavaScript front ends by waboremo on Saturday December 10, 2022 @03:59PM (#33936738)
Tools like htmx aren't the reason the gmail tab uses a GB of memory. You'll find the majority of cases where pages are using way more resources than it should, are due to reasons forced on web developers, like a billion different trackers and several different ad networks, and workarounds to ad blocking to sell more subscriptions, etc.

This is what is so shocking to me when HN spends such an absurd amount of time rallying around this idea that frameworks are the reason sites are bad. Mind you, I do think a lot of them are misused, but 99.9999999% of poor websites aren't because of the framework chosen.

Re:Breaking up with JavaScript front ends by t8sr on Saturday December 10, 2022 @04:18PM (#33936893)
According to my browser, the default view in gmail needs 8.32 MiB of javascript spread over 90 files to render.

While IDLE, the gmail tab uses 10-30% of an M1 CPU core.

That stuff is not down to tracking - it's because the damn thing keeps messing with the DOM, because it has some insane structure where javascript controllers are attached as strings to DOM elements, because it uses about 100 divs to render every row in the list of messages, and because every message is nested literally 15-30 layers deep in a pointless tree of divs.

I am sorry, but web frontend is an insane dumpster fire.

Re:Breaking up with JavaScript front ends by wruza on Saturday December 10, 2022 @06:09PM (#33938050)
I haven’t tested the following claim and not at the computer atm (^U, see below), but divs must be cheap. They’re just structures which a rendering engine walks through and computes hierarchical offsets of via stylesheets.

I’m not arguing for using hundreds of divs, because that’s a sign of engineering insanity imo, but it’s not a performance issue. You can create a static page with thousands of them and (likely) see that it still doesn’t use 250Mb+ neither idles at 30% cpu core.

Added:

damn thing keeps messing with the DOM … web frontend is an insane dumpster fire.

Totally agree with these parts.

—————

… I just tested 50 div-rows with 200 spans containing numbers from 1 to 199. Total 10k elements, text doesn’t fit on the screen. Bootstrap css+js is imported via CDN.

Mithril.js implementation uses 50Mb of RAM consistently.

A static page with the exact same content uses 71-96Mb depending on the run.

Both use 5-14% cpu when I shake my mouse and 0% when I don’t.

Refresh is significantly faster with Mithril, idk why, probably because static html parser is slow. (Opera, Windows 10, no extensions).

With a single span per row instead of 200 both take 23Mb.

Removing bootstrap from the head inconsistently frees 0-2Mb for both.

Re:Breaking up with JavaScript front ends by minusf on Saturday December 10, 2022 @07:36PM (#33938652)
maybe they are cheap, maybe not. but lighthouse prints a warning for "excessive number of dom elements" already at 1500...
Re:Breaking up with JavaScript front ends by smoldesu on Saturday December 10, 2022 @05:06PM (#33937391)
What browser are you using? Having Gmail open doesn't even use half of a percent of a single core on my machine (Linux, x86, Chromium).
Re:Breaking up with JavaScript front ends by t8sr on Sunday December 11, 2022 @01:42AM (#33940739)
Chrome on an M1 Pro Mac. This is the number that Chrome’s task manager shows me.

I do have a lot of emails, but I think it should only have to worry about 100 of them at a time, so I don’t know why it’s different for me and you. It is possible that my account still receives beta features, because I used to work there, but I remember it being like this for multiple years, since the new gmail came out.

Re:Breaking up with JavaScript front ends by smoldesu on Sunday December 11, 2022 @10:54AM (#33944217)
Are you using Chrome through Rosetta? I'm still unable to replicate this on either my desktop or laptop, both of them just idle when I open Gmail and neither will push past 5% usage while I'm opening emails. Your metrics seem a bit odd here.
Re:Breaking up with JavaScript front ends by vbezhenar on Sunday December 11, 2022 @12:59AM (#33940518)
Same for macOS, Chrome. CPU sometimes jumps to 3%, but that's about it (and I guess that's because it uses slow core).

I have very clean mailbox, though.

Re:Breaking up with JavaScript front ends by Throwaway23459 on Saturday December 10, 2022 @10:50PM (#33939873)
Well google use all of their own internal 'frameworks', so you can't really use their web applications to judge the rest of the web.
Re:Breaking up with JavaScript front ends by t8sr on Sunday December 11, 2022 @01:44AM (#33940749)
This used to be true but isn’t anymore. For a while they pushed Angular, nowadays I think a lot of teams are using react. GWT is long deprecated and gone.
Re:Breaking up with JavaScript front ends by mattlondon on Sunday December 11, 2022 @07:23AM (#33942569)
I think citation needed on that one.

From what I understand (no special insider information) React is essentially non-existent inside of Google, and NPM is not even available to engineers (be default)

Re:Breaking up with JavaScript front ends by t8sr on Sunday December 11, 2022 @05:51PM (#33948471)
I am not sure how much I can say, because I used to work there. But I think it's OK to say many Google engineers don't particularly like Angular.
Re:Breaking up with JavaScript front ends by panopticon on Sunday December 11, 2022 @06:25PM (#33948774)
It depends what org you're in. Cloud seems to use a lot of Angular, but the rest of the company is coalescing around an in-house framework called Wiz (you can poke around the open sourced jsaction library to get an idea of the design philosophy).
Re:Breaking up with JavaScript front ends by kaba0 on Sunday December 11, 2022 @05:21AM (#33941940)
To be fair, gmail was quite great at the time of GWT. Not sure how much use their Clojure “platform” still get, but I think it was very ahead in terms of maintainability of large js code bases (or even ahead as we have it now)
Re:Breaking up with JavaScript front ends by DHPersonal on Sunday December 11, 2022 @12:14AM (#33940337)
I keep saying the same thing at work on the NextJS / MaterialUI project I’m working on and I largely get blank stares in response.
Re:Breaking up with JavaScript front ends by smaudet on Saturday December 10, 2022 @04:21PM (#33936928)
If you can limit yourself to exactly one, maybe two external deps, which are really just to make your dev life eaiser, you may have something of a point.

You have to remember that a large chunk of "web apps" means "electron apps" which are absolute bloated pieces of junk next to their desktop cousins.

You also have to remember a 'framework' typically doesn't stand in isolation - tens, hundreds, thousands of dependencies typically lurk.

We all agree tracking junk makes it even worse, but the whole thing is already overcomplicated before you get to that point.

Re:Breaking up with JavaScript front ends by ryanbrunner on Saturday December 10, 2022 @05:17PM (#33937501)
> You also have to remember a 'framework' typically doesn't stand in isolation - tens, hundreds, thousands of dependencies typically lurk.

While this is true, at least by having a large number of people commit to the same set of dependencies, you stand a higher chance of complications between those dependencies being ironed out, either directly by the framework maintainers or by the user base of the framework.

Re:Breaking up with JavaScript front ends by Tade0 on Sunday December 11, 2022 @12:16AM (#33940343)
> This kinda crap is why the gmail tab uses a GB of memory.

Actually no, and the real reason is organisational.

It has been a pattern for years now for front-end projects to consist of multiple, independent modules developed by separate teams - banking apps are a prime example of this.

Gmail appears to have went the same route, because it now sends over 200 requests when loading - a hallmark of a highly modularized front-end.

The organisational benefit is less knowledge required per developer, which in turn brings other advantages like resistance to turnover.

Re:Breaking up with JavaScript front ends by t8sr on Sunday December 11, 2022 @01:40AM (#33940723)
You can say that about any engineering problem and be right 99% of the time. Because it’s always true, it’s not a super useful analysis.

Somehow, software on embedded, the kernel, graphics, flight control, etc. is all developed by equally large organizations and while they’re far from perfect, they produce far better software than the vast majority of web UX organizations.

Something about web dev is uniquely terrible, in addition to the common factors you mentioned.

Re:Breaking up with JavaScript front ends by Tade0 on Sunday December 11, 2022 @04:28AM (#33941647)
I think you judge it like that because errors in UI are usually the most visible.

Meanwhile I can't get my laptop into sleep mode at times because such a seemingly simple feature can't be reliably implemented for some reason and it's been like that for years - that's just one out of many instances of non-web software being terrible.

Re:Breaking up with JavaScript front ends by cerved on Sunday December 11, 2022 @04:19AM (#33941596)
There's a lot of great software that's not written by people who work with web development. There's also plenty of utter garbage software that's not written by people who work with web development. I don't think web development sticks out enough to make it unique
Re:Breaking up with JavaScript front ends by nicoburns on Saturday December 10, 2022 @04:03PM (#33936770)
Gmail is just poorly written. The old version of Gmail was still an SPA, and it was perfectly quick.
Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @04:50PM (#33937217)
Well, get ready for it. GitHub is moving towards React, Next, etc. I bet it will be another disaster like Reddit.
Re:Breaking up with JavaScript front ends by riversflow on Saturday December 10, 2022 @08:49PM (#33939148)
I’m actually happy about how garbage reddit is. I considered installing a redirect plugin to send me to the old.reddit subdomain[1], but ultimately decided I shouldn’t encourage myself to use Reddit, having it load into that dumpster fire of a front end has really helped discourage me from using or interacting with it. I can happily report my reddit usage is at an all time low!

[1] fun fact, you can shorten this to “ol.reddit.com” which is nice because it only requires one hand to touch type “ol.” and get an autocompletion. I always thought reddit was a great name because for right handed users, “redd” could be typed with the hand that would typically stay on the keyboard and would 100% get an autocompletion. Alas, most users are now on mobile.

Re:Breaking up with JavaScript front ends by guilherme-puida on Saturday December 10, 2022 @11:09PM (#33939982)
> I considered installing a redirect plugin to send me to the old.reddit subdomain

I use RES[1] to force the old layout (along with many other things).

1: https://redditenhancementsuite.com/

Re:Breaking up with JavaScript front ends by vasili111 on Sunday December 11, 2022 @10:58AM (#33944259)
Where is that setting in res? I was looking but could not find it.
Re:Breaking up with JavaScript front ends by t8sr on Saturday December 10, 2022 @04:21PM (#33936926)
Yeah, I agree - the old version of gmail was perfectly reasonable. But the current version is IMO representative of trends in web dev. Google is both influential and tends to follow the recent trends. Gmail is by no means unique - every web app created in the past few years is the same insane jumble of frameworky js code and a DOM 100 layers deep, just because someone can't be bothered to learn CSS and plain JS.
Re:Breaking up with JavaScript front ends by nicoburns on Saturday December 10, 2022 @04:31PM (#33937023)
Google's frontend engineering tends to be pretty poor and out of step with wider industry practice in my experience. They have created not one, but 3 of their own frameworks (Angular, Angular 2 and Polymer), two of which (Angular and Polymer) were rather poorly performing, and the third of which is kinda ok but doesn't seem to be that widely used internally. They tried to create their own frontend language (Dart), which nobody uses.

Meanwhile most of the industry is using React, which is actually pretty well engineered and perfectly fast (you may well find yourself using a slow React app, but that's not React's fault).

P.S. Talking layer of DOM nodes, I actually did a few samples of this the other day. Gmail has 34, which was by far the deepest of any website I checked and probably isn't helping it's performance.

Re:Breaking up with JavaScript front ends by taeric on Saturday December 10, 2022 @06:11PM (#33938070)
You didn't even mention GWT. I don't know what is causing it, but yeah, Google has dropped some turds over the years.
Re:Breaking up with JavaScript front ends by johnthuss on Saturday December 10, 2022 @06:27PM (#33938167)
The original version of GWT was mainly about solving compatibility issues between browsers (of which there were many). Modern GWT/J2CL is all about leveraging the mature Java development tools, especially code completion. GWT can be used with just the standard DOM APIs very effectively these days via the elemental2 library.
Re:Breaking up with JavaScript front ends by taeric on Sunday December 11, 2022 @12:21PM (#33945151)
Apologies on the slow response.

That makes sense, but I also recall it was about trying to use the same language on the server as the client. And it worked as well as the efforts to use JavaScript is the server. Which is not to say it can't work. There are a lot of traps there, though.

Re:Breaking up with JavaScript front ends by runarberg on Saturday December 10, 2022 @08:44PM (#33939126)
Material Design is also Google’s fault. Regrettably a pretty sizable chunk of the industry either uses it directly or—worse—incorporates elements of it in their design.

I also have a pet peeve with the Roboto font family developed by Google and used everywhere on the web. But I’ll admit that it is a fine font face for its purpose, just very boring and used way too much.

Re:Breaking up with JavaScript front ends by thex10 on Saturday December 10, 2022 @09:01PM (#33939250)
> Talking layer of DOM nodes, I actually did a few samples of this the other day.

Is there a tool for this? I’m kind of wanting to check my site now…

Re:Breaking up with JavaScript front ends by nicoburns on Monday December 12, 2022 @08:53AM (#33954602)
You can run the following snippet in the console:

    function getMaxNestLevel() {
        var i = 1, sel = '* > *'; /* html > body is always present */
        while(document.querySelector(sel)) {
            sel += ' > *';
            i++;
        }
        return i;
    }
    
    console.log('total nodes', document.getElementsByTagName('*').length);
    console.log('max nest level', getMaxNestLevel());
Re:Breaking up with JavaScript front ends by neoberg on Saturday December 10, 2022 @04:13PM (#33936856)
As a side note; iirc the old version of Gmail was the first big scale example of SPAs.
Re:Breaking up with JavaScript front ends by Throwaway23459 on Saturday December 10, 2022 @10:53PM (#33939885)
React and Angular are both blazing fast, and are definitely not pointless. Open create react app, spin up a page with 50000 buttons, compare that to a plain js version, then come back and tell us about the atrocious performance.
Re:Breaking up with JavaScript front ends by ttfkam on Sunday December 11, 2022 @09:15AM (#33943361)
Apparently you've never heard of event delegation, which has been around for at least twenty years? (I could swear I was using it on IE6, but I might be misremembering.) At any rate, the plain JS way of handling 50,000+ HTML buttons efficiently is a long-solved problem.

https://javascript.info/event-delegation

Re:Breaking up with JavaScript front ends by Throwaway23459 on Sunday December 11, 2022 @06:43PM (#33948925)
You appear to be reading more into my post then I intended. The point I was illustrating is that there is no cruft in React.

Try and keep your posts factual.

Re:Breaking up with JavaScript front ends by phist_mcgee on Sunday December 11, 2022 @03:27AM (#33941341)
So you haven't done web development in 12 years, but you're qualified enough to call these frameworks pointless?

I haven't written Java in years so I can tell you with authority that Java 17 is terrible and we should just go back to the good old days of J2EE.

Re:Breaking up with JavaScript front ends by t8sr on Sunday December 11, 2022 @10:08AM (#33943791)
I feel qualified, because I’ve been a SWE for 20 years, have worked in lots of domains (including web, sometime ago) and so I feel I am able to draw comparisons.

Not for nothing, but when I wrote a couple of web apps recently (most recently a market monitoring tool and a physics simulation in wasm and webgl for rendering), I tried different frameworks, but always ended up dropping them. The end result is snappy and fits in kilobytes, and the freaking back button works.

I did of course use some libraries for rendering things like graphviz. I am not a crazy person. But I fail to see what value e.g. react.js* adds, or why there are libraries to wrap websockets.

* For react specifically, I can actually imagine scenarios where it’s useful, but in practice, 95% of places where it’s used should have probably just been HTML with some minor JavaScript for bits of interactivity.

Re:Breaking up with JavaScript front ends by phist_mcgee on Sunday December 11, 2022 @06:22PM (#33948750)
I've also worked as a SWE for many years, and I can tell you hands down that self-rolled frontend codebases are _always_ harder to maintain and add features to, than ones that lean into frameworks and libraries. They are shared understandings that are easily transferrable between contexts.

You don't mention maintainability in your examples, purely things like back button support and disk footprint. They're just pieces in the puzzle.

Re:Breaking up with JavaScript front ends by afavour on Saturday December 10, 2022 @10:51PM (#33939876)
> This kinda crap is why the gmail tab uses a GB of memory.

It isn’t. Ironically things like memory leaks are why pages use a ton of memory and in my experience everyone coding from scratch results in more of them, not less.

Re:Breaking up with JavaScript front ends by t8sr on Sunday December 11, 2022 @01:34AM (#33940690)
I really don’t agree. When I worked at Google, I filed a couple of bugs for memory leaks in the new gmail, and to my knowledge they still haven’t been addressed two years later, because there are a million dependencies and the thing is so complex no one can debug it, or even come up with a reliable repro.
Re:Breaking up with JavaScript front ends by sph on Sunday December 11, 2022 @02:10AM (#33940910)
Memory leaks, like bugs, tend to scale linearly with code size. You better believe your 100k line framework has more leaks than my 1000 line script.
Re:Breaking up with JavaScript front ends by afavour on Sunday December 11, 2022 @09:15AM (#33943364)
Strong disagree. Frameworks are almost always going to be better profiled, better tested and have more eyes than any home crafted code. The number of lines isn’t really that relevant.
Re:Breaking up with JavaScript front ends by 0xblinq on Sunday December 11, 2022 @02:41AM (#33941085)
Well, the thing is… for any non trivial web app, you do need a framework (spa or Unpoly like). The question here is if you use an existing one or end up writing your own.

I don’t buy the “just use html, js and css”… giving the same developer skills, without a framework that becomes a mess much sooner than with one. Unless you’re just building a small landing page or todo app.

Re:Breaking up with JavaScript front ends by sph on Saturday December 10, 2022 @01:57PM (#33935583)
Unpoly is pretty good, and operates on a slightly different level than htmx, which is all about AJAX. Also, this slideshow is from 2016, when htmx was pretty much unknown.
Re:Breaking up with JavaScript front ends by hoistbypetard on Saturday December 10, 2022 @08:35PM (#33939058)
> Also, this slideshow is from 2016, when htmx was pretty much unknown.

HTMX 0.0.1 was released as "kutty" in May 2020. That was its first release. It wasn't a thing in 2016.

Re:Breaking up with JavaScript front ends by recursivedoubts on Saturday December 10, 2022 @09:15PM (#33939350)
htmx is intercooler.js 2.0

intercooler.js started in 2013

https://github.com/bigskysoftware/intercooler-js/commit/62d3...

Re:Breaking up with JavaScript front ends by ramesh31 on Saturday December 10, 2022 @01:34PM (#33935305)
>I'm actually very intrigued by the whole "let's take a step back and move a lot of our logic back to the server" approach to modern dev,

What's old is new again.

There's an entire generation of developers now who have no concept of the old world. They started with React/Angular/Vue and have no idea that SSR was the standard default for decades. And now it's a "new idea" that is held up against JS development with no understanding of why and how we got to where we are, and the tradeoffs that were made along the way.

Re:Breaking up with JavaScript front ends by qrohlf on Saturday December 10, 2022 @01:45PM (#33935437)
I both agree and disagree with this take.

I started out hand-coding static html pages, graduated to Drupal and Wordpress php stuff circa 2009 (glad that's over!), then worked on a largely server-rendered Rails SAAS in the APM space that I guarantee you've interacted with if you've been in the web game for more than a couple years. These days, I may sling React for my 9-5 but a lot of my personal projects and internal tools are vanilla express apps with very little client-side code.

It's true that a lot of newer devs really don't have a great deal of context for why React & company became the de facto default for building websites and how much we used to get done with largely server-based architectures. I wish we did a better job of teaching fundamentals here rather than bootcamping everyone straight into building SPAs.

However, it's also true that the baseline expectation for web experiences is a lot higher in 2022 than it was in 2009 in terms of the level of responsiveness, interactivity, and overall "app-like-ness", to the point where I think that even with the massive improvements in bandwidth, latency, and web protocols, we still need to accept that there are many cases where just shoving full HTML documents over the wire isn't enough to satisfy user & stakeholder expectations. That's where stuff like LiveView, htmx, and Web Components become interesting to me. The web has evolved, and finally the server-side-application paradigm feels like it's starting to evolve along with it, and these evolutions do feel like they're novel & useful enough to deserve being called "new ideas".

Re:Breaking up with JavaScript front ends by t8sr on Saturday December 10, 2022 @03:57PM (#33936722)
> However, it's also true that the baseline expectation for web experiences is a lot higher in 2022 than it was in 2009 in terms of the level of responsiveness, interactivity, and overall "app-like-ness", to the point where I think that even with the massive improvements in bandwidth, latency, and web protocols...

What? The exact opposite is true: the average web app (including ones like gmail) is far less responsive, slower and heavier than it was 10 years ago. On my M1 Pro, gmail renders at about 20 fps and takes 2-3 seconds to load on gigabit fiber. The web has never been shittier than it is today.

Re:Breaking up with JavaScript front ends by trollied on Saturday December 10, 2022 @06:02PM (#33937992)
Agree 100%. Also makes me laugh when people talk about server side rendering. Serving a html page isn’t rendering. The fact that a couple of megabytes of JavaScript ever became responsible for making the simplest of pages even display is possibly the worst technology regression I’ve ever seen.
Re:Breaking up with JavaScript front ends by Winsaucerer on Saturday December 10, 2022 @06:31PM (#33938206)
I think 'rendering' here means something like 'doing what's needed to produce the final HTML for the browser to render'. You can produce the final HTML on the server (server side rendering), or the front-end (e.g., via DOM manipulation), or mix them up (e.g., HTMX replacing parts of the DOM with pre-rendered HTML from the server).

i.e., there's two different steps that each do something that can be called 'rendering': templates to HTML, and HTML to what the user sees in their browser.

I'm inclined to agree with the main sentiment of your post though, and lean myself towards solutions that rely on the server heavily with just a splash of javascript on the front end.

Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @05:04PM (#33937371)
> However, it's also true that the baseline expectation for web experiences is a lot higher in 2022 than it was in 2009

Is it?. I think this expected behavior and increased complexity comes more from designers and product owners than from real actual users.

I, as a user, still enjoy a lot more the old Reddit (old.Reddit.com) than the new one. I even prefer hackernews than many other more “modern” forums that feel slow and bloated. And I also prefer the current GitHub to what I bet it will become the moment they start moving it to React.

Re:Breaking up with JavaScript front ends by Winsaucerer on Saturday December 10, 2022 @06:42PM (#33938281)
I like new Reddit’s cards layout when scrolling, but I don’t enjoy its poorer performance and new thread view.

The good bits from new reddit could have been added without heavy JS, since those are just CSS+HTML.

Re:Breaking up with JavaScript front ends by noahtallen on Sunday December 11, 2022 @04:30AM (#33941656)
I mean, the broad problem is web performance. I think that client-side rendering is a red herring, and really not the main problem. I think part of that issue is that developers don't spend as much time optimizing performance, because it's less clearly necessary up front.

Web in particular is very hard to optimize for performance just because of its inherent platform limitations. For applications, people expect as-good-as-desktop. But you can't just download a big .exe and install it -- you have to transfer everything over the wire, which is obviously very expensive. So the big optimizations are reducing how much you need to do that. In apps where people click to new pages and do server-roundtrips for interactive data constantly, you can reduce the amount of time your blocked by caching stuff in the browser. For pages which transfer a lot of data, you must use webpack and similar tools to compress and optimize the various bundles.

The second issue is that when people experience slow and annoying websites, it's normally because of ridiculous ad tracking and subscription popups, which are things most web devs don't really care for. But this is also how the web is funded, so you can't just wish it all away. But this is completely unrelated to client-side rendering frameworks.

Another point is it's not like servers are automatically fast. Sure, more powerful than client computers, but also serving many times more people at once. You'll have to do performance optimizations for servers too.

So my main point is that 1. client-side rendering being slow is usually a red herring. and 2. with any site, you should be optimizing performance. That includes both client and server, both of which can be tricky to optimize

And I do think baseline expectations are higher. For example, on old.reddit.com, when I open a post, it opens a new page. When I go back to the post list, the whole page reloads, which takes time (and I'm on a gigabit network). It's a lot faster in new Reddit, where everything happens on the client. At the same time, I'll certainly agree that it's very poorly optimized in many cases. I think there are some memory leaks. It's a solvable problem, though. It's not bad because it's using React; it's bad because they haven't taken the time to optimize its performance.

And talking about GitHub. The new client-side nav is a lot faster for navigating around a codebase than the full page reloads it used to do. It makes sense, that's a huge part of the page you can just leave there. It's a performance optimization to use more client-side rendering in this case, pretty clearly. Fewer round trips to the server (very slow), less data to fetch overall because half the stuff on the page doesn't need to change... etc.

And products like Google Sheets and Google Docs have also really pushed hard on client-side interactive features that were not common 10+ years ago, but are more common today.

And talking about hacker news... here are some problems hacker news has that modern websites typically don't have:

- Form submission weirdness, particularly around the back button

- Have to go to a new page and reload the old page when writing/editing a comment. More round trips to the server.

- Styles are poorly optimized for visibility on both desktop and mobile.

- On mobile, touch targets are very small.

- Form markup is limited and opaque (e.g. most people expect to have a toolbar for rich text options).

Re:Breaking up with JavaScript front ends by chiefalchemist on Saturday December 10, 2022 @03:02PM (#33936246)
Yes "app-like-ness" when that's appropriate. But a lot of the web isn't that. Yet devs / agencies are using a sledgehammer (e.g., React) when a Phillips head screwdriver is what's need.

Users get experiences they don't need (nor want). Site owners gets a maintenance dependency they don't want (nor need).

Re:Breaking up with JavaScript front ends by TranquilMarmot on Saturday December 10, 2022 @03:34PM (#33936528)
I think the basic divide is something like "CRUD forms" vs "interactive applications".

I've built basic CRUD forms with ASP.NET MVC. I've built them with Rails. I've built them with React (+ a hundred random libraries). I've also built interactive "apps" in those languages.

Looking back, the amount of "interactivity" that React adds to a CRUD form is NOT worth the added complexity. But! Right now my dayjob is creating an _insanely_ complex app that you could not have done five years ago with Rails (or, like this presentation is about, something like Unpoly).

I think a problem is that React is just more _fun_ to work with than basic server stuff so devs want to work in it. The added complexity is worth it to have more fun. Maybe that's just me, though. I know a lot of people see React as a hammer to hit every nail with, and I was like that for a long time, but I'm starting to come back around to more server-driven use cases for simple sites.

I've been messing with Fresh a lot lately and it's a nice middle ground of defaulting to rendering _most_ stuff on the server, but you can have "islands" of interactivity that get sent to the client as JS. I'm not sure if it will end up gaining traction, but it's pretty nice.

https://fresh.deno.dev/

Re:Breaking up with JavaScript front ends by crooked-v on Saturday December 10, 2022 @07:01PM (#33938415)
> CRUD form

This stands out to me as one of the cases very few JS frameworks have gotten right. Remix, with its "all mutations are just form actions" approach, is the only one that stands out to me as having done it well.

Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @05:15PM (#33937482)
I agree with everything you said up to the part about fresh and deno, where it looks like you’re falling in the same trap of those wanting to use react. You don’t even notice it but this is the problem. Always thinking the next shiny tool will solve the problems.

Rails, Lararavel and similar frameworks are great for crud apps. No need for fresh or demo or svelte or next.js for that.

Re:Breaking up with JavaScript front ends by TranquilMarmot on Saturday December 17, 2022 @10:07PM (#34034701)
I don't think that Fresh or Deno will solve any problems that aren't already solved. In fact, there are a lot of very frustrating bits about Fresh that worked a lot nicer in i.e. Rails. I would not use Fresh in production right now; if I were making a generic CRUD app I would probably use something a lot easier and with a bigger community around it.
Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @05:08PM (#33937408)
From my experience, this problem is also rooted on designers and product owners.

My own team “modernized” a forum/blog tool used for internal documentation by moving a lot of it to react and SPA architecture and added ton of “app like” features, and I just hate the thing now. The old version, which we still run on some installations, is way, way faster, easier to use, more responsive and more reliable.

But hey, it looks so App-like now…

Sigh…

Re:Breaking up with JavaScript front ends by whatever1 on Saturday December 10, 2022 @01:42PM (#33935404)
SPAs solved a labor problem I think. It was the reason that front end development grew so fast.

It is much faster to train people on a combo js+css framework rather than training someone on backend languages, databases, queues, authentication, scaling + html & css for server side rendering.

Re:Breaking up with JavaScript front ends by jrochkind1 on Saturday December 10, 2022 @01:48PM (#33935477)
That seems strange to me as being an "old school" developer I have a lot more trouble trying to get a hang of the new front-end stuff than I do learning a different back-end framework.

But I guess that is just me/generational? Ironically, I feel like there are a lot more job openings for front-end than for back-end now, and I'm much more comfortable on the back-end.

Re:Breaking up with JavaScript front ends by _gabe_ on Saturday December 10, 2022 @01:54PM (#33935538)
We use SPAs and a pretty strict typescript/react stack. And I still have to know:

Cloud Tech (AWS) which also includes, lambdas, Iam management, dynamoDB, cdk or serverless, API gateway, S3, secret managers etc.

Add to that list the technologies that often get thrown in for extra monitoring testing etc. Jest or mocha/Chai for unit tests. Dynatrace for monitoring. Kibana or something for logs. Some tool for analytics. Github actions for setting up deployment and CI. Maybe you need redis for intermediate caching, etc.

In addition, before you kind of sort of had an intuition of how the data flowed through your basic stack from the database to the web page. Nowadays who the heck knows what's happening. You'll hit some api gateway endpoint which auths through a random lambda who knows where on what server, then it will go hit the actual lambda that holds the function you want to call which may reach out to a database but get intercepted by the redis cache etc etc etc.

Yes modern web dev is definitely much simpler /s.

Re:Breaking up with JavaScript front ends by misterpurple45 on Saturday December 10, 2022 @03:18PM (#33936406)
I see this “AWS for everything” Well-Architected stuff everywhere. AWS benefits greatly from inserting itself in between all our architectural layers.

There’s nothing stopping companies from using the cloud for its primitives (compute and storage), maybe with managed FOSS services (RDS Postgres). We don’t _need_ to go all in on AWS to build a ‘modern’ web application. Yet somehow much of the industry dances to AWS’ tune on how to architect software.

Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @05:21PM (#33937542)
And good luck with having a development environment or even decent end to end/integration testing once you start using all those services.
Re:Breaking up with JavaScript front ends by epolanski on Saturday December 10, 2022 @09:07PM (#33939288)
Architects in my company are required to have aws certificates. They can be monkeys but if they can list a dozen of AWS products and put everything there they are given the keys of everything.
Re:Breaking up with JavaScript front ends by __jem on Saturday December 10, 2022 @03:53PM (#33936683)
You may work at a company that requires fullstack expertise, but there are plenty of other companies where frontend developers are fully insulated from all those cloud technologies. I'm not sure what your point is here tbh.
Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @05:19PM (#33937527)
A friend of mine moved to a company where they use plain Laravel (with just some sprinkles of js using Alpine) and they deploy to heroku. A team of 10 devs, no systems/devops/Infra and he’s fascinated how well things go and how fast they ship stuff compared to where we worked together before (with all the usual react/redux stuff and an elixir backend on kubernetes)
Re:Breaking up with JavaScript front ends by whatever1 on Saturday December 10, 2022 @02:38PM (#33935993)
I wouldn’t say modern web dev is simpler, I just think it is more decoupled. This helps with training for & staffing the more specialized roles that emerged.
Re:Breaking up with JavaScript front ends by strife25 on Saturday December 10, 2022 @02:43PM (#33936040)
Labor wasn't the issue, it was UX.

Users wanted responsive UIs and Gmail showed the power of AJAX in the browser. In the mid-2000s, server power, network latency, and maintaining state were the challenges. The UX was more powerful when the client tracked state, only requested the data it needed, etc.

Things have flipped. SPAs became bloated as abstractions were introduced. Network latency and server power is not an issue anymore. Rendering a bunch of HTML is as quick as rendering JSON.

As a vet of the IE7 days, I love this trend. Leveraging the best of server compute and browsers is going to simplify web app development a LOT.

Re:Breaking up with JavaScript front ends by pjmlp on Saturday December 10, 2022 @02:53PM (#33936144)
Ajax was created by Microsoft to show Outlook on the browser....
Re:Breaking up with JavaScript front ends by diroussel on Sunday December 11, 2022 @11:44AM (#33944746)
Not quite what I remember. XMLHttpRequest was invented by Microsoft and used in a outlook webaccess. This was only possible in IE6.

But Ajax is merely a pattern that was enabled by the ‘dynamic html’ that was made possible by having a DOM and JavaScript. It was possible in Netscape years before IE6. I did a production app with Ajax in 1999, using IE4. Before the term Ajax had been coined.

Re:Breaking up with JavaScript front ends by t8sr on Saturday December 10, 2022 @04:01PM (#33936752)
AJAX in early Gmail was a massive improvement. It was mostly hand-coded javascript in a relatively thin page and it was the sweep spot. Today's version of gmail is the most bloated pile of spaghetti framework code imaginable and is far less responsive and usable than the plain HTML version.
Re:Breaking up with JavaScript front ends by claytongulick on Saturday December 10, 2022 @01:45PM (#33935441)
Or maybe people don't like waiting for a page to load each time they click a button?
Re:Breaking up with JavaScript front ends by ryanbrunner on Saturday December 10, 2022 @09:33PM (#33939466)
People want responsive interfaces, absolutely. Whether the interface is implemented as full page requests to servers or AJAX requests is irrelevant to users.

Bare AJAX itself almost always will perform better than a full page request, but as you layer on additional requirements, frameworks, libraries, etc. that isn't always true.

I think old reddit and new reddit are a great example of this - both are processing the same data and presenting a very similar UX. But at least for me, the relatively javascript light old reddit interface with full page reloads feels much more responsive and usable than the new site.

Re:Breaking up with JavaScript front ends by yetanother12345 on Saturday December 10, 2022 @05:11PM (#33937443)
IMHO this is a false argument.

Ask yourself: Do "people2 prefer looking at "spinners" or more-or-less animated "page loading..." texts?

Waiting time is the issue, the technology is not.

A server generated page that loads fast beats a Framework-generated page hanging every time!

As for technology:

With "classic" server generated pages "people" will know what is going on (browser indication tht page is loading) and they will know what to do (wait a few seconds at most). With frameworks "people" are left out in the cold with no indication what the problem really is and no apparent remedy or path for solution as a page refresh might interfere with state logic or whatnot bringing totally undesired results.

Re:Breaking up with JavaScript front ends by JackMorgan on Sunday December 11, 2022 @06:45AM (#33942385)
A lot of dev managers like that they can turn one team into two teams by splitting everyone into front and back end. This makes hiring easier. I cannot emphasize this enough. Easier hiring is a huge deal.

As a secondary effect it also allows for more kingdom expansion. It's much easier to have two teams of five than one team of ten.

That being said, I'd rather manage a team of five good full stack engineers than ten average front/back end engineers. The communication cost of trying to get features out the door with two teams of five is very high.

Re:Breaking up with JavaScript front ends by AtlasBarfed on Saturday December 10, 2022 @01:49PM (#33935487)
Then why is every JS-bro "full stack"?
Re:Breaking up with JavaScript front ends by knightofmars on Saturday December 10, 2022 @04:33PM (#33937053)
IMO, I think this is a valid question (though asked a bit crudely). To generalize, it's because someone who has done JavaScript programming can point to NodeJS and say, "I'm full stack." Which, while technically true, skates over the reality of NodeJS as a less than ideal backend (see Ryan Dahl and the dawn of Deno). Second, it's more lucrative to bill oneself as "full stack" even if in reality a person isn't. At one point in my career I would have considered myself "full stack". Over time I realized that a "full stack" engineer is a jack-of-all-trades type, which in theory, can be valuable in the right circumstances as an individual doing work alongside non-full-stack engineers. Asking a room full of "full stack" engineers to design and build a product of any complexity above CRUD will naturally lead to a self-sorting of UI/UX and server side engineers.
Re:Breaking up with JavaScript front ends by eurasiantiger on Saturday December 10, 2022 @06:17PM (#33938105)
Exactly. Full stack engineers are sorely needed in every project because they can see the forest from the trees, not because they are experts in everything from botany to carpentry.
Re:Breaking up with JavaScript front ends by bandrami on Saturday December 10, 2022 @07:36PM (#33938655)
As somebody who started in the days of cgi-bin and SSIs, I've lost track of how many wheels I've seen re-invented over the past 25 years. Fortunately I do backend which is at least slightly more stable (modulo the fact that I'm sending more or less opaque-to-me javascript rather than html).

OTOH I have really surprised some PMs by producing a Perl cgi wireframe site during the course of the meeting where we designed the wireframe so we could actually try it. It's a skill more devs should really have in their back pocket.

Re:Breaking up with JavaScript front ends by duxup on Saturday December 10, 2022 @02:15PM (#33935774)
> What's old is new again.

I work on some old ColdFusion apps.

Some aspects feel very modern.

Re:Breaking up with JavaScript front ends by robertoandred on Saturday December 10, 2022 @07:20PM (#33938558)
What’s new is being able to use the same templating on the front and back ends with the same code, libraries, languages, and concepts.
Re:Breaking up with JavaScript front ends by boxed on Saturday December 10, 2022 @04:19PM (#33936902)
I've tried to use htmx exactly two times. Both times it just ran directly into a brick wall, because it's so limited and has no escape hatch where you can put your own logic. Their solution to this is their half baked new language, which isn't ready, a new language, and seems very much unclear. All they needed was proper hook points.
Re:Breaking up with JavaScript front ends by recursivedoubts on Saturday December 10, 2022 @09:21PM (#33939392)
htmx is focused on hypermedia exchanges in the mode of normal HTML, so client-side stuff is out

it does, however, have an extensive event model to hook into, including pre and post request processing:

https://htmx.org/reference/#events

as well as an extensions API:

https://htmx.org/extensions/#defining

for client side scripting, I think you are talking about hyperscript, which is definitely more speculative than htmx, but I wouldn't call it half baked: a lot of people are using it successfully in production

a less-esoteric alternative would be to use alpine.js, which is similarly embedded but uses plain ol' javascript (and offers reactivity as well, hyperscript is more of a pure event-driven language)

Re:Breaking up with JavaScript front ends by hliyan on Sunday December 11, 2022 @12:01AM (#33940274)
Just checked alpine.js. While it's very nice, was a bit worried about this potentially risky eval use:

    <div x-html="(await axios.get('/some/html/partial')).data">
Re:Breaking up with JavaScript front ends by remram on Sunday December 11, 2022 @09:31PM (#33950170)
What's risky about evaluating your own code on your own pages?
Re:Breaking up with JavaScript front ends by boxed on Sunday December 11, 2022 @03:06AM (#33941228)
The hooks are very limited unfortunately.
Re:Breaking up with JavaScript front ends by recursivedoubts on Sunday December 11, 2022 @09:32AM (#33943531)
can you be more specific?

there are a large number of events

and the extension mechanism has enabled a diverse number of extensions:

https://htmx.org/extensions/

generally I consider htmx to be on the high side of JS libraries when it comes to events and hooks that can be used

Re:Breaking up with JavaScript front ends by ducharmdev on Saturday December 10, 2022 @08:52PM (#33939183)
I had this same experience. I thought it sounded like an interesting idea, but in practice I didn't think it lived up to some of the hype it often gets on HN.
Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @04:53PM (#33937251)
In my opinion Unpoly does this in a very nice way, with what they call “compilers”.
Re:Breaking up with JavaScript front ends by lifthrasiir on Saturday December 10, 2022 @09:40PM (#33939518)
I think htmx can do the same with built-in events---just not built-in. In fact you may even skip that one today because custom elements are wildly supported since 2020.
Re:Breaking up with JavaScript front ends by caseyf on Saturday December 10, 2022 @04:29PM (#33937011)
More like a hotwire but instead of being extracted from Basecamp's work it feels like it could have been extracted from Makandra's work maintaining many different Rails apps.

I think it's very good and for me, the best of the bunch. I'm moving a very large app to it (from old school RJS) and it seems to have thought of everything that I need.

Re:Breaking up with JavaScript front ends by dinkleberg on Saturday December 10, 2022 @01:50PM (#33935509)
Just want to point out that unpoly has been around for ages (looks like since 2015). This isn’t a copy of htmx.
Re:Breaking up with JavaScript front ends by lewantmontreal on Saturday December 10, 2022 @07:36PM (#33938653)
Would be interested to know if they stuck with it
Re:Breaking up with JavaScript front ends by triskweline on Sunday December 11, 2022 @03:39PM (#33947239)
Author here. Yes, we stuck with it and evolved the concept into Unpoly 2 and soon Unpoly 3:

http://triskweline.de/unpoly2-slides/ http://triskweline.de/unpoly3-slides/

I'd say 95% of the apps we build are now based on Unpoly, the rest on React.

We now believe SPAs are not a good default for the type of apps we're building. We're still reaching for SPAs when requirements demand high-frequency user input and optimistic rendering, e.g. for a chat or online game.

YMMV!

Re:Breaking up with JavaScript front ends by cphoover on Saturday December 10, 2022 @04:32PM (#33937048)
My problem with liveview IMHO is that it requires an active internet connection and doesn't have offline support, which is a step in the wrong direction in terms of UI performance to me.

It makes sense for a subset of applications that require connectivity but many apps or tools should be able to work offline or without a constant connection.

Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @04:56PM (#33937282)
Livewire is intended to be used where you’d otherwise need to do an API call anyway. It is not intended to handle every single click and toggle and key press. You still do that on the front end, usually with Alpine.

It is a way to avoid writing backend APIs.

If you’re sending every click or every key press then it’s not the tools fault. I agree though, that this should be better explained in their docs.

Re:Breaking up with JavaScript front ends by sodapopcan on Saturday December 10, 2022 @06:57PM (#33938381)
They said LiveVIEW not LiveWire. Same-ish deal, though.
Re:Breaking up with JavaScript front ends by 0xblinq on Sunday December 11, 2022 @01:39AM (#33940721)
Oh, sorry. I missed that.
Re:Breaking up with JavaScript front ends by say_it_as_it_is on Sunday December 11, 2022 @05:42AM (#33942048)
A web application requires connection to the web, which only exists with network connectivity. What you're trying to do is create a desktop application with tools built for the web. Therein lies the problem.
Re:Breaking up with JavaScript front ends by cphoover on Sunday December 11, 2022 @05:31PM (#33948296)
This is not true. Applications only require network connectivity for the initial resources to be downloaded. After that they can be cached, service workers can also be used to provide for offline support. Plenty of applications can run only in the browser and don't need to have a constant connection to a back-end. I can think of a calculator app, where all of the application logic exists on the client in JavaScript, in this case a network connection is an unneeded dependency. But once you build it with a framework like liveview it cannot work without a constant connection.
Re:Breaking up with JavaScript front ends by 0xblinq on Saturday December 10, 2022 @03:26PM (#33936467)
To me it looks like the opposite. It’s more batteries included, easier to use and has been around for longer. I like htmx too, but too me it’s only better on the marketing side.
Re:Breaking up with JavaScript front ends by dmix on Saturday December 10, 2022 @04:11PM (#33936842)
The way it componentized the different ‘cards’ or fragements with URL-style lego blocks seems to be the primary novel feature that’s layered on top of HTMLX.

This is already the direction that Remix and Deno’s Fresh framework seem to be taking, at least spiritually. Isolated server-rendered-first approach and only bare minimum JS loaded for fragments/islands that need to be interactive beyond what can be loaded on pageload.

The html attributes vs JSX style templates is really a matter of taste IMO. Although I haven’t used htmlx I get the feeling it would be limiting for more complex cases and involve a lot of hackery or pigeonholing complexity better served by straight up Typscript.

Re:Breaking up with JavaScript front ends by zozbot234 on Saturday December 10, 2022 @01:58PM (#33935594)
I'd try to optimize logic on the client before moving more logic back to the server. This is essentially what Svelte and SolidJS do - they clean up a lot of the existing overhead of SPA solutions. Of course, rendering server-sent HTML as in the HTMX model (or perhaps HTML generated in-client via WASM) instead of doing costly fine-grained DOM updates could then be added as a further optimization.
Re:Breaking up with JavaScript front ends by smrtinsert on Saturday December 10, 2022 @04:58PM (#33937303)
I had this going back around late 2000s with jQuery and Spring Web Flow. It was absolutely glorious. Server side declarative navigation (great for dev coordination), seamless transitions, less bandwidth consumed, super simple client side rendering, no more issues with the PRG pattern and user interference, and I even think I put in even listeners to execute animations based on the return fragment.

Never was allowed to put it into prod - "didnt need it". Oh well.