Menu

Should you continue to use jQuery?

Should you continue to use jQuery?

I get asked alot of questions about jQuery. And most are pretty valid for a curious mind learning to code. A few popular ones are the following:

1. Should I learn jQuery?
2. What's the benefit?
3. Is it still popular?
4. Will it make me amazing?

And the answers are varied, but essentially, you should use jQuery for a number of reasons which I will detail down below. And perhaps a few reasons why maybe you shouldn't use it. But at the end of the day, using jQuery is akin to going to a restaurant instead of making your own dinner. Sure, you pay a little more but you end up with the same ingredients (though maybe more calories) and you bypassed the messiness of having to clean up the kitchen.

Quick history

jQuery is a JavaScript file. It wraps many functions from JS into a more concise syntax. For example:

$('#id');
// vs
document.querySelector('#id');

And it kind of looks like this:

jQuery did not appear from the ether. It was built by John Resig, a software developer from Boston. Go Red Sox. Here is John's LinkedIn for your cyber-stalking pleasure if you so wish.

Since it's inception jQuery has been used in millions of websites around the world. According to buildwith.com, the number is estimated to be the following.

That's a fair marketshare, to say the least. Much of that has to do with the fact that it has been around since 2006, during a time where there weren't many options really.

"Continue" to use it?

Alright, first off, if you are working on a website or project that is using jQuery, don't remove jQuery. Unless you want to spend the next few months replacing every $and every jQuery function to some other equivalent.

I would also recommend not transitioning out of using jQuery either for an alternative framework. Not only can it cause cross-framework problems on some deep unseen level that will spring up at the most inopportune time, but you can cause performance issues and confusion in the long term. And confusion among programmers is a huge reason for many of today's biggest coding blunders.

And as stated earlier, there are also an approximate 60+ million websites using it, which means that it will probably be supported for a good number of years. And this is one of it's main strong suits. It has longevity, which means that many of the bugs that were prevalent during its early years are now long gone. It's not perfect, by no means. You can view the list of open bugs and see for yourself. But maintenance is ongoing and improvements are being made constantly.

It has also gotten more efficient as far as performance goes in terms of its animation capabilities. So you can spend more time designing, engineering and architecting and less time worrying about frames, sprites and GPU spikes.

Competition

jQuery does not have much competition. There are alternatives, sure. If you Google around a bit, you can see a few popular names here and there, such as Cash or UmbrellaJS. These claim to be the better solution to jQuery because of their smaller filesize and footprint, but their syntax is still similar to jQuery in many ways and their usage is of course not on par with jQuery.

UmbrellaJS for example has the following usage metrics:

You can compare that to jQuery:

And the similar case is true for many other current frameworks that are aiming to take on the giant.

I'll say this, there is a space for these frameworks in the future, but it won't be due to their filesize. That's a very shortsighted way of looking at technology. Each day we jump leaps and bounds in terms of storage capabilities and network bandwidth. An 8kb file is not better than a 56kb file. Not anymore.

If these other frameworks are to grow and thrive, they will need to begin to target other aspects or pain-points in web development. Things that are actual concerns for programmers and web developers.

So is jQuery just perfect?  It is not without its shortcomings. For one, it's a subset of JavaScript, so by definition it is adding another complexity layer on top of JS that isn't without a cost. I ran a few tests to measure jQuery's performane not that long ago, and the results were interesting to say the least. You can read more about that right over here.

It isn't perfect, but it is very useful still. Not only in reducing the amount of keystrokes, which do add up if you are working on a project with millions of lines of code. But in performing certain tasks that really are tedious to code by hand, such as fading elements in and out, attaching events, making ajax requests and many DOM manipulation tasks as well.

I went years without using it myself favoring the more vanilla approach to coding, which has its benefits for sure. More control of your code being the primary one. But this might not be so important or even that frequently required really.

If you are using jQuery and have read online about why it's a dying framework, I am here to assure you that it is not. It's still very much alive and ticking and growing in terms of usage. To quote the Dark Knight:

You either die a hero, or live long enough to see yourself become the villain.

Happy coding.

Walter G. author of blog post
Walter Guevara is a Computer Scientist, software engineer, startup founder and previous mentor for a coding bootcamp. He has been creating software for the past 20 years.

Get the latest programming news directly in your inbox!

Have a question on this article?

You can leave me a question on this particular article (or any other really).

Ask a question

Community Comments

n
9/27/2019 11:53:20 PM
This Article was very useful and thanks for the information. for Trainee and beginners. https://www.cprcertificationcourses.com/acls-certification-course/
Ad Unit

Current Poll

Total Votes:
Q:
Submit

Add a comment