GitHub Removes jQuery. Why?
Written by Ian Elliot   
Wednesday, 01 August 2018

In an almost super-human effort, GitHub has removed all trace of jQuery from its fontend code. This is interesting, but the real question is why? The most obvious answer is that programming is subject to the same whims of fashion as other technical disciplines - perhaps even more so because change is mostly easy.

Perhaps it would be fairer to say that change is notionally easy. We are all subject to the idea that the easiest way to improve a code base is to tear it down and start again. After all, we love creating our code from scratch and hate having to maintain a messy, inherited, code base. Of course, in truth our pristine code soon evolves into the messy inherited code base we have worked so hard to banish.

When Google decided to start from scratch with the Chrome browser it was a wondrous thing, but now it is fat, bloated, slow, memory hungry and with a confusing and often stubborn UI.

So it is now with the negative reaction to jQuery.

If you don't know, and if you don't then this isn't going to make a lot of sense, jQuery was a lifesaver. It provided the standard JavaScript library we all so badly needed. It provided a way of taming the wild west of different browsers and their intentionally different ways of doing things. Instead of having to write browser-specific code you simply wrote to jQuery and mostly it just worked on a range of browsers.

jquerybanner

Not only did it smooth things over, jQuery provided more advanced capabilities and a whole style of programming in JavaScript. You can thank jQuery and its creators for making fluent function chaining popular, and a whole lot of other JavaScript idioms. You could, and still can, learn a great deal about JavaScript by reading the jQuery code. In fact, being able to understand it easily is good proof that you are a JavaScript programmer and not a "some other language" programmer pretending to know JavaScript.

Over time, however, what jQuery was doing seemed to be increasingly irrelevant. As HTML 5 came into view, and browsers started to get their acts into some sort of conformity, so jQuery's smoothing over didn't seem so important. Also CSS added the sort of selectors that jQuery provided and after a while jQuery even adopted native CSS selectors in its sizzle selector engine and added warnings that using non-native selectors would be slower.

Does this mean jQuery is redundant?

A number of blog posts and even web sites, e.g.

http://youmightnotneedjquery.com/ 

certainly seemed to push the point of view that if you used jQuery to do a job that you could do with HTML/CSS or plain JavaScript, then you were somehow a less-than-good programmer. Slowly but surely the smart guys were in the business of telling the dumb guys that jQuery was old school and deprecated, and so were you if you used it.

Certainly there was a new impetus to evaluate the need to include jQuery in a new project, but to rip it out of existing projects? This is madness driven by fashion.

GitHub isn't alone in responding to such pressure. BootStrap has removed jQuery from its latest version and it's not alone. The number of frameworks that are abandoning the use of jQuery is likely set to grow, but this isn't quite the same thing as what GitHub has done. Frameworks are reused by lots of people and if they can reduce a dependency then this is probably a good thing. You can always add jQuery if you want to use it along side BootStrap or whatever.

However, what GitHub has done is different - we use its code but we don't (in most cases) reuse its code:

gihubjquery

 The bullet points are interesting. Let's look at them one by one.

  • The querySelectorAll is the CSS selector which jQuery uses if it is available. Using jQuery to do the same job is more consistent across browsers and it lets you use fluent function calls to simplify code.

  • Fetch for ajax is not available on all browsers, but jQuery ajax is a sophisticated reworking of the traditional ajax calls which works on everything. Put simply, jQuery does so much more.

  • Delegated events - jQuery recreates the DOM event handling in a more logical and sophisticated way and it is probably its least known advantage.

Polyfils for standard DOM stuff - now at this point you should be laughing on the floor. So you replace well-crafted, well-tested polyfils in jQuery for hand-crafted custom polyfills.

  • Custom elements on the rise. What does this mean? Adoption of modern things like the shadow DOM, web components? It is true that jQuery doesn't have a good way of doing custom UI elements, jQueryUI is ok but it misses out on modern features, but there still isn't a 100% coherent way of doing the job.

guthubdwevsq

While it is true that jQuery isn't a vital as it once was, it is still relevant and extremely useful.

So why the backlash?

First it has to be the usual fickle flip in fashion. What was once the latest and hottest quickly becomes the most despised. By rubbishing the technology of the existing cohort of developers, the next establishes itself as superior - even if it doesn't have anything better.

Another reason is a deep misunderstanding of what jQuery is and does. If you just see it as a long-winded way of writing querySelctorAll then, of course, you think you don't need it. Far too many JavaScript programmers are as shallow as this suggests.

Remember the next time you hear someone saying how they don't need jQuery that they are simply revealing how little they know of jQuery.

There are many more non-technical reasons for the current rejection of a very reasonable technology, I'm sure you can think of your own. Notice that I'm not criticizing the skills of GitHub's engineers. I'm sure they have done a good job at removing jQuery and what they replaced it with probably has advantages - this is in the nature of reworking things. I am criticizing the political decision to do the job at all.

If it ain't broke don't fix it.

But we programmers have a deep drive to fix anything that is in the slightest bit "mature". Yes, we see mature code as broken and we tend to call it "legacy".

A blank code base is an exciting code base.

jquery3

 

More Information

https://twitter.com/mislav/status/1022058279000842240

Related Articles

jQuery 3.2.1 Is Out - Do We Still Care?

Microsoft Buys GitHub - Get Ready For a Bigger Devil

jQuery 3.0 Final Released

JQuery And Dojo Foundations To Merge

Vanilla JS Used On More Sites Than jQuery

JQuery Ever More Popular

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin.

 

Banner


Python Popular With Hackers
03/10/2018

The latest news of Python's popularity comes from a cyber security software and services company which provides protection to enterprise data and application software. Imperva reports that around [ ... ]



Couchbase Launches JSON Analytics
28/09/2018

There's a new analytics service for Couchbase that comes with SQL++, a query language framework that can be used to write queries on document-oriented data and the JSON data format.


More News

Python

 



 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962579>

<ASIN:1871962560>

Last Updated ( Wednesday, 01 August 2018 )