Live data from Hacker News

Gov.uk drops jQuery from their front end

web.dev

361–370 of 458 posts

Re: Gov.uk drops jQuery from their front end

#361
post #241

When I first started programming I was pretty lucky to get a job at a games company. My first lead was a veteran who had shipped a lot of AAA titles and he loved his war stories. He was personally interested in performance and he would often cite hardware timings for specific cpu instructions. One story he told a couple of times was about some grey beard who was before his time. The grey beard was once a legend in th…

Amusingly, I always joke that I'm fluent in jQuery, but no absolutely no javascript. As a mostly backend go/python/non-javascript developer that has always held true. It is just a tool in the belt for an engineer. Can you use jQuery in 2022 or later to solve really amazing problems that impact user experience? You sure can! Would you be better off to use a modern javascript variant and stuff like react instead? You a…

> Now if I was asked to write a front end today, I'd have to sit down and properly learn react + typescript (because javascript is awful without sensible type checking), and that would add to the time to ship, but is the correct thing to do.

It really is enjoyable working w/ react+typescript. :)

Re: Gov.uk drops jQuery from their front end

#363

Earlier quoted context omitted.

Yes, the DOM API is painful to work with.

Time to drag out this old classic: https://pics.me.me/what-does-l-use-jquery-jquery-mean-tmeans...

Hah. My first "web apps" were CGI scripts back in 1995. I know enough about the DOM to know that it sucks: document.getElementById is too verbose. I can either define my own function as a shortcut, or use a standard approach for the same. jQuery is that standard approach.

Re: Gov.uk drops jQuery from their front end

#364
post #340

Earlier quoted context omitted.

This is a fair criticism of how I chose to tell the story. The line you quoted was supposed to refer to the character introduced in the second paragraph and not to a generic stereotype of aged man. I can see how my choice of wording created an implication that people who have grey beards are old and that it is this oldness that contributes to their unwillingness to learn. The familiar cliche of "you can't teach an ol…

IMHO this analogy doesn't really click, on multiple levels. Any old timer who uses jQuery surely is also aware of querySelectorAll and friends. There's even an entire website dedicated to catering to exactly that transition[0]. I don't think anyone defending jQuery is doing so out of a sense of hubris towards outdated knowledge, but rather because it ironically is more lightweight than a lot of the modern SPA craze,…

Thank you. That needed said.

Re: Gov.uk drops jQuery from their front end

#365

I still use jQuery for frontend JavaScript when I can. It's so much more efficient than native JavaScript. I can't imagine anyone prefers to write document.getElementById('element').style.display = 'none' rather than $('#element').hide();

There are fewer and fewer people who know jquery, so while this might be convenient for you or me, this is just more cognitive overhead for programmers who don't know jquery. There are multiple ways to hide an element, and what does `hide()` do? Some future programmer will need to look this up, and every other jquery method they stumble across. The main problem I have with jquery though is there's no convention for e…

On Alpine...

I have had such a positive and lovely experience with it. It's the reactivity I've always wanted; ie plays nicely with VanillaJS without imposing a complex build process.

Re: Gov.uk drops jQuery from their front end

#366

Earlier quoted context omitted.

Really? I see 40+ people as diversity hires for the most part. They're there so no one can say the company is ageist. The "good" devs become managers or magically disappear. Magically as in they get banished to some other realm I've never been able to see. That, to me, says there's plenty of ageism. If it was as simple as "they ask for too much", then someone would snap them out of it and we'd see plenty of older dev…

> The "good" devs become managers or magically disappear. Magically as in they get banished to some other realm I've never been able to see. I agree with you here - the question is why? I don't think it's because we're discriminated against for being old, I think it's because in 99% of cases (we can't all be donald knuth), our cost grows faster than our skills. So we either move to management/business (where experien…

I think the dominant effect is because the whole field is rapidly growing, so newly trained and younger is a disproportionately high amount relative to if it was at a steady state.

Re: Gov.uk drops jQuery from their front end

#367

Earlier quoted context omitted.

This is a fair criticism of how I chose to tell the story. The line you quoted was supposed to refer to the character introduced in the second paragraph and not to a generic stereotype of aged man. I can see how my choice of wording created an implication that people who have grey beards are old and that it is this oldness that contributes to their unwillingness to learn. The familiar cliche of "you can't teach an ol…

> I think of this story whenever I see jQuery popup on Hacker News. There is always a strong contingent of devs who swear by this library. But to me, they are like the old grey beard who didn't update his knowledge as the times changed. This is a strawman argument. It's a biased view you hold. Because of that, you make up a story to match your biases around people who use such-and-such library don't think they need t…

> Who cares if it's a bit more code

Well, Gov.uk for one, as per the article you're commenting on. As they pointed out:

> Not everyone is tapping away on their 2022 MacBook Pro on a rip-roarin' broadband connection. GOV.UK has to be accessible to everyone, and that means keepin' it lean.

> Here's a few of the greatest hits from Matt Hobbs on what GOV.UK noticed in removing jQuery:

> - Less front end processing time overall.

> - 11% less blocking time at the 75th percentile.

> - 10% less blocking time for users at the 95th percentile. These are users who experience seriously adverse network and device conditions, and every performance gain matters especially for them.

Re: Gov.uk drops jQuery from their front end

#368
post #239

Earlier quoted context omitted.

I think you're greatly exaggerating the death of jQuery > old trick's won't work > writing is on the wall jQuery still works and is used in an crazy amount of websites. It's not going away soon. The biggest downside is the extra network request, but it's probably cached in 99% of browsers, so all that's left is some extra CPU time. You're also exaggerating the claims of jQuery defenders. No one here is arguing that t…

Chrome started partitioning the cache a couple years ago to mitigate timing attacks, so there's no network savings anymore when a bunch of sites all link to the same jQuery cdn entry.

Fair enough. But it is still cached for your site.

Re: Gov.uk drops jQuery from their front end

#369

Earlier quoted context omitted.

I rather not write 10 lines of Vanilla JS when I can write a line using jQuery. And I do prefer jQuery-style syntax for manipulating the DOM.

Absolutely. I stopped using actual jQuery a while ago in favor of a light (78 loc) wrapper around the native DOM that mostly uses the jQuery API. jQuery has a really well thought out fluent API. https://gist.github.com/pseudosavant/b86eedd9960ade958d49447...

This doesn't have closest(), next(), prev(), siblings() and a bunch of other DOM traversers.

Re: Gov.uk drops jQuery from their front end

#370

AFAIK (I'm not a front-end dev but tried some) vanilla JavaScript has much of the things jQuery provided built-in nowadays yet they look much longer. Now as JavaScript accumulated a lot of legacy stuff only kept for compatibility + also numerous verbally/syntactically sub-elegant APIs IMHO it is time to design a language which would simply be "better JavaScript" - clean, modern and elegant yet have no fundamental dif…

The future will probably be that anything complicated enough to require frameworks like React will eventually move to web assembly, then you are free to use a newer language or compiler which strips out legacy mistakes and old sites can keep shipping their binary which will always work. Already a few of the complex web apps have become webasm.
Post reply on HN