Why Gov.UK Stopped Using jQuery (web.dev) 88
The head of the UK government's digital transformation unit recently announced a change to the nation's government services site gov.uk: they've "removed jQuery as a dependency for all frontend apps, meaning 32 KB of minified and compressed JavaScript was removed" for everything from selecting elements to attaching event listeners....
Nearly 84% of mobile pages used jQuery in 2021, points out a new essay at Gov.UK — before explaining why they decided not to: jQuery was an instrumental tool in a time when we really needed a way to script interactivity in a way that smoothed over the differing implementations of stuff like event handling, selecting elements, animating elements, and so on.
The web is better because of jQuery — not just because it has such incredible utility, but because its ubiquity led to making what it provided part of the web platform itself. Nowadays, we can do just about anything jQuery can do in vanilla JavaScript... It really begs the question: Do we really need jQuery today? That's a question that GOV.UK has answered with a resounding "no"....
This is a big deal when it comes to the user experience, because GOV.UK provides services and information online for The United Kingdom at scale. 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.... dependencies matter when it comes to performance. Don't shortchange your users if the web platform can easily do the job a framework can.
This level of commitment to the user experience from a institution that works at the scale GOV.UK does is commendable. I can only hope others follow in their footsteps.
Nearly 84% of mobile pages used jQuery in 2021, points out a new essay at Gov.UK — before explaining why they decided not to: jQuery was an instrumental tool in a time when we really needed a way to script interactivity in a way that smoothed over the differing implementations of stuff like event handling, selecting elements, animating elements, and so on.
The web is better because of jQuery — not just because it has such incredible utility, but because its ubiquity led to making what it provided part of the web platform itself. Nowadays, we can do just about anything jQuery can do in vanilla JavaScript... It really begs the question: Do we really need jQuery today? That's a question that GOV.UK has answered with a resounding "no"....
This is a big deal when it comes to the user experience, because GOV.UK provides services and information online for The United Kingdom at scale. 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.... dependencies matter when it comes to performance. Don't shortchange your users if the web platform can easily do the job a framework can.
This level of commitment to the user experience from a institution that works at the scale GOV.UK does is commendable. I can only hope others follow in their footsteps.
Re: (Score:2)
they would print all the hundreds of pages and scan them one by one! I know because we called after several (charged) hours had passed and we still didn't have that easy signature!
I think I understand why they didn't adopt your more efficient process...
Re: (Score:2)
Crap. When I last worked for a law firm (mid-1990s), a sizeable one with offices all over the world, that is what the very top partners were billing.
Obviously law has gotten quite a bit more expensive, even adjusting for inflation.
Re:Your tax dollars at work, folks! (Score:4, Informative)
Re: (Score:2)
Re: Your tax dollars at work, folks! (Score:2)
The thing is, for non-Americans, this expression is not synonymous with talking about tax. It really does sound ignorant when used incorrectly, and that reflects on the speaker for their thoughtlessness. As they say around here: engage your brain before your mouth!
Re: (Score:2)
Where I live, the culture & public political discourse don't share those attitudes & so the term doesn't apply. Some of that rhetoric has got through into UK public discourse but again, the cultures are so different that the rhetoric has taken on di
Re: Your tax dollars at work, folks! (Score:2)
A lot of people both in the UK and the US think that because we share a common language everything else is mostly the same too. It really isnt. The culture is different, the political systems are VERY different (the US system is based on the French one) , the legal systems are different and the people are different, eg the UK is mostly agnostic and open whereas the US is rather more religious and insular.
Re: (Score:2)
At least they didn't use the tax dollars to try to overturn an election like they did here in the U.S.
But man, still... what a waste of time and resources!
They're not dollars and the thing you're talking about didn't happen.
So, fail. But I imagine you're used to that.
Re: (Score:2)
Re:WTF? (Score:5, Informative)
Re:WTF? (Score:4, Interesting)
Which was an incredibly stupid idea. We had getElementsByClassName which was more than adequate for any practical use. I banned the use of jQuery way back in 2006. Anyone who witnessed Resig's startling incompetence on alt.lang.js back then knew to stay far, far, away from anything he produced.
Re: (Score:3)
Re: (Score:2)
Anyone who witnessed Resig's startling incompetence on alt.lang.js back then knew to stay far, far, away from anything he produced.
Could you expand on this at all? I remember Resig (briefly, at least) had a reputation as a wunderkind.
Re: (Score:2)
You should be able to dig up the discussions between him, David Mark, and a few others from that period. Google groups now has those old newsgroup archives. I shorted it, but it's properly alt.lang.javascript. One bit I think is a nice exemplar was the battle between feature detection and browser detection. I found no reason to believe that the self-proclaimed "javascript ninja" had more than a cursory understanding of the language.
Re: (Score:2)
I think it was comp.lang.javascript, not alt. You can also find a lot of commentary on the situation by googling "jquery" in combination with various negative terms used to describe IT issues. From what's out there, Resig sounds a bit like Drepper.
Re: (Score:2)
Ah, you're right. It's been a while since I've been on usenet.
Re: (Score:2)
What can't you accomplish with document.querySelectorAll that you can with jQuery?
Re: (Score:3)
The use case for JQuery is supporting old incompatible browsers. JQuery handles all the corner cases for you.
If you don't need to support legacy browsers, then you don't need JQuery.
I no longer use JQuery in new webapps. Just raw JavaScript.
I also use a lot of WebAssembly compiled from C++.
Re: (Score:2)
The use case for JQuery is supporting old incompatible browsers. JQuery handles all the corner cases for you.
That was never true. Not even a little. It was just part of the computing folklore that people never bothered to validate. Worse, jquery was notorious for introducing incompatibilities between browsers! This is probably because Resig didn't have clue and stubbornly refused to believe that he could be mistaken about anything. It took a really long time to get him to understand that properties and attributes are different things.
Re: (Score:1)
Re: (Score:2)
What can't you accomplish with document.querySelectorAll that you can with jQuery?
Web pages that function in Internet Explorer.
Re: (Score:2)
Sorry, I meant to reply to somebody else...
Re: (Score:2)
No worries.
The point is that jQuery is totally obsolete now and should be removed where possible.
Starting new projects with jQuery is madness.
Blindly adding unneeded frameworks is more amatuer (Score:5, Insightful)
Thatâ(TM)s always been the case. Theyâ(TM)ve accomplished nothing other than doing a bunch of busy work, and their sites likely run slower, because unlike jQuery, their bespoke code has not gone through nearly as much vetting or performance testing/tuning. Honestly this smacks of amateur hour bullshit
You choose the right tool for the job. If jQuery wasn't adding anything to the experience, they shouldn't use it. JQuery is nice, but no, I am not certain it is essential these days. Your emotional statement makes me hope you're not a software professional. I can tell you as a full-time software engineer, I am having to fight mediocre devs who want to throw in every framework under the sun and can't tell me why. I have many fights where people want to do things with the most frameworks possible, probably to pad their resume. If a framework helps, use it. If it doesn't, don't. Don't just use a framework because it's cool or because it's useful in other situations but not the current one. I also get a lot of people asking to make things super complex for simple problems...just in case our fundamental business model changes.
I'd question how many pages really need a full JavaScript stack. Why do they need complex UI frameworks if they're just simple forms? Do you really need Angular and JQuery and a dozen other JavaScript frameworks if you're writing a simple "Contact Us" form? Why not use HTML5 plus some basic JavaScript validation.
What's amateur hour about your attitude is that you're not considering the user experience. If the user just needs basic HTML, then JQuery is not adding and thus is, at best, a tolerable nuisance.
You need to think about the impact of your decisions. In my opinion, efficiency is very important. For starters, with the cloud computing paradigm, we pay very directly for inefficiency, especially on backend systems. For example, if you 1 megabyte of JavaScript and transfer 256k of data across 10 REST calls, but could have just done everything with a server-side template, which I know is not as fashionable on your resume, and sent 300k in a fraction of the total time, then you've wasted a lot of money and built up a lot of complex machinery just to pad your resume that never benefits the user.
In my case, my employer doesn't even care much...they'll happily write a bigger check to our cloud computing provider, but there's also a carbon footprint to your shitty decisions. You could have used a simpler technology stack or older technology and made the page load in 1/10th of a second instead of 1/2 of one, it would be a nicer experience for people on mobile or shitty connections, it would save your company a noticeable amount of money and reduce pointless energy consumption. Some apps benefit from a complex modern stack. Most don't.
I wish more engineers ignored you and focused on solving the problem and not following fads or trends. The user should never have to suffer because you don't know how to use legacy technology or are more concerned with padding your resume or wanting to try out cool new frameworks that were designed to solve more complex problems than solving the actual problem at hand. If that organization only needs a simple solution, they should use what fits best.
Re: (Score:2)
I can tell you as a full-time software engineer, I am having to fight mediocre devs who want to throw in every framework under the sun and can't tell me why.
I can tell you why, they are cherry picking functions from different packages because they don't know how to write it themselves or/and too lazy to adapt already available functionality. They have no understanding how much shit and transient dependencies are dragged in when they spin up their code somewhere.
I'm in the process of cleaning up a repo were there have been 15 different developers doing stuff over 10 years with no real oversight. I've been at it for 4 weeks now, weeding out all the stupid fucking
Re: (Score:2)
I keep running into stuff like this, usually after the original dev(s) have left and I'm assigned responsibility for all their work.
Unmanaged external dependency graphs rank very high on my list of software engineering antipatterns.
Re: (Score:2)
I've also always wondered why, if 105% of all web sites were using it, it wasn't provided natively in browsers, it seems like that'd be one of the first things you want to add as a native capability..
I guess it was because the browser vendors were too busy adding rounded corners to tabs and arguing over whose Javascript engine could run an empty loop faster than anyone else's.
Re: (Score:2)
jQuery has different versions which are incompatible with each other. If a browser implemented the current version of it, that wouldn't work for most of the sites that are running ancient versions. And if the browser tried to evolve the features as jQuery evolves, sites implementing the previous version would become broken.
Of course, browsers can and probably do optimize to ensure that they run jQuery code as fast as possible. Popular frameworks may get preferential treatment because they affect the browser
Re: (Score:2)
> If jQuery wasn't adding anything to the experience, they shouldn't use it.
But, but ... all the StackOverflow answers use jQuery!
Re: (Score:2)
Mostly agree, but:
Those "mediocre devs" are themselves "full-time software engineers". Just saying.
Coders perhaps. But I would not call them software engineers.
A competent software engineer, almost by definition, understands how to architect, design, code, test, deploy, and maintain software, balancing among the client's needs for time to market, quality, and cost, and keeping the costs (including size, performance, quality, maintainability, technical debt, etc.) manageable, starting with whatever point in the software's lifespan he or she first encounters it. Even if it has been
Re: (Score:3, Insightful)
their sites likely run slower, because unlike jQuery, their bespoke code has not gone through nearly as much vetting or performance testing/tuning. Honestly this smacks of amateur hour bullshit
jQuery is the very definition of amateur hour bullshit.
Re: (Score:2)
Javascript sucks (Score:4, Funny)
Why are we still using it in web browser and *shudder* server software?
There are countless problems with it. Why not use another language, for web front-end... like brainfuck. Brainfuck has (iirc) only 8 statements, each one character long.
Another option is whitespace. There's lots of room for comments in that language.
Re: (Score:2)
Re: (Score:2)
Brainfuck has 9 characters, though.
We rewrote our codebase around nine times... (Score:2)
JavaScript. I love it! I wouldn't recommend it. [youtube.com]
Re: (Score:2)
I was sympathetic to your complaints about javascript... until you suggested we move to Brainfuck and blew your credibility.
Re: (Score:2)
Have you tried JSFuck [jsfuck.com]?
Welcome to the UK (Score:4, Interesting)
I can assure you, being a resident of the UK, that this doubtlessly disenfranchises more people than it takes care of. While our broadband rollout is appalling our economy and education are second to everyone. Basically, old browsers and old computers will rule out more people than 32K of compressed javascript. The government of the UK hates the working class. They have a success mechanism revolving around exploiting their fears and as such see every opportunity to increase those fears. Lack of access and education breeds stupidity, stupidity breeds fear, fear breeds the easily led. This is the Tory mantra. They are almost literally the Sith of politics. Almost no one hear can see or hear it, they're caught up in the wrangles between left and right, often in the same party. Often in engineered controversy, manufactured and employed. Tick tock. We're a hairs breadth away from facism over here. A prime minister that can evade any controversy isn't even regarded as blatant.
Re: (Score:1)
The GOV.UK domain and sites are independent of any specific political party?
Been around for many years ...
And surely removing unused dependencies from web access only adds to the accessibility/servcies for all thing, not detracts?
Re: (Score:2)
The GOV.UK domain and sites are independent of any specific political party?
Been around for many years ...
And surely removing unused dependencies from web access only adds to the accessibility/servcies for all thing, not detracts?
This. OP has clearly never had to use any other government's online (or offline) services. When I moved to the UK I found the GOV.UK sites, everything from HMVI to DWP to even the DVLA to be simple and easy to use. Just accept that the British are fastidious about forms and make sure you follow all instructions when filling them out. This is a lot better than Australia, who's government IT projects are never finished piles of crap that cost 3 times as much as they needed to (govt contract in Oz == License
Re: (Score:2)
Why? jQuery didn't exactly help when it came to legacy browser support, and could even make the problem worse. Not that it matters now, as it dropped "support" for older browsers a long time ago. Anyone writing to standards should have no problems writing code that works just just as well on a new computer as one that's 10 years old without the help of a half-assed bloated library written by an incompetent who was still struggling to learn the basics.
Re: (Score:2)
Re: (Score:2)
Nothing wrong with old machines. It's old software running on them which is the problem. Even on a 32 bit machine from a decade or more ago, you can certainly run a modern browser... just not with the operating system originally installed on it all those years ago.
Re: Welcome to the UK (Score:2)
This,folks, is why we hanged our Tories.
Re: (Score:3)
What has that got to do with gov.uk? Having had to use a large selection of other countries government web portals as I travelled a lot during the pandemic, the UK one stood out as being the easiest to use and most responsive by a long way. It provides a consistent interface for virtually everything a UK citizen needs to do online, which is more than I can say for the USA, for example, and is set up for maximum accessibility and speed.
There are lots of things wrong in GB but gov.uk is not one of them, IMO.
Comment removed (Score:5, Informative)
Re: (Score:2)
And guess what tool allows you to support both modern and legacy browsers at once?
What is it? It's definitely not jQuery.
Re: (Score:2)
Computers are really bad about those these days, it's abstraction layers all the way down.
Sometimes it's just better to write code without relying on abstraction layer after abstraction layer.
Sometimes it's better to not try to support old browsers that are probably a nasty security issue on the computers running them.
Sometimes it's better to just create a damn website without making it so complicated that it doesn't work across browsers...
Browsers bloated in the 90s folks, weren't
Re: (Score:2)
?I agree mostly. If a framework or tool allows you to prototype, iterate, develop, and/or debug faster, that's a win. Building a website from scratch is a slow process. Personally I use Angular and Angular Material and I can get a UI prototyped in almost no time at all, and then immediately start filling in functionality. Much better than the good ol' days when all we had was jQuery or nothing.
The caveat I have is about performance. jQuery specifically I doubt makes much of an impact, unless they were hosti
Re: (Score:2)
If you want half decent performance you need to parse and compile that Javascript into something more efficient, like bytecode or even native code. That's where the memory and CPU time go.
All modern browsers do that.
Re: (Score:2)
Why not jquery? (Score:1)
Re: (Score:1)
Re: (Score:3, Insightful)
How is this any different than attaching a vanilla onclick event to each li?
The only incredibly stupid thing here is the programmer. A wrapper around js that allows the exact same thing you could do in vanilla js is not the fault of the wrapper.
Re: (Score:2)
How is this any different than attaching a vanilla onclick event to each li?
In vanilla, you would never do that because you'd immediately see the absurdity of what was actually happening and instead choose to attach just one listener to a common containing element. Not just because it's sensible, but because it's less effort. In jQuery, the absurd way is easier than the sensible way. That's what I mean by "encourages incredibly stupid things".
There is also the tendency to use jQuery for things that should be done with CSS. Imagine if the reason you were attaching one or more ev
Re: (Score:2)
Re: (Score:1)
JQuery provides no tangible benefits for existing either. Its usage is for amateurs who don't know what they are doing. Hell, all of JavaScript is a convoluted shitshow of a mess. It's such a terribly designed language and I cannot wait for its death.
Lets see how long and how much it costs (Score:2)
If the register is accurate, almost every other week there is some news or other about cost overruns or deadlines being extended for IT projects in UK.
Lets see how this goes.
Remember why jQuery exists (Score:1)
Yes, frameworks come at a cost (Score:1)
You can usually tell when a site is using one or more frameworks; it's slow. Those that use native JavaScript are lean and peppy. Frameworks present gobs of extra code to load and compile on the client side, and can encourage sloppy and inefficient code design (especially jQuery). Today's compiled frameworks (like Angular) are a good solution for those who really like the convenience of frameworks, but want to avoid the client-side load. These provide all the extensive functions of frameworks, then compile