Jump to content

Is jQuery Still Good?

DriedSponge
Go to solution Solved by C0stanza,

jQuery works as well as it ever did today but a whole lot of its use cases have been replaced either by native JS functionality or newer, more specialized libraries. Back when I first began web development around 2014/15 jQuery contained a whole lot of functionality that was pretty critical to a new website or webapp. It was used for making asynchronous calls to external APIs, it had better selectors than normal JS getElementById/Class, it had a weird early form of promises, it was even able to handle basic animations if I remember right.

 

Basically it patched in almost all of the functionality we needed but didn't get from vanilla JS in one library (especially since it was often safer to use jQuery than vanilla JS due to differences between browsers making it likely vanilla JS code behaved differently between browser). It was pretty much an auto-include (along with underscore if you were fancy).

 

Nowadays it still works but there are a couple reasons it isn't the swiss army knife everyone uses for everything.

 

1) To speed up their apps by relying on smaller dependencies than jQuery. There are lots of popular, more specialized, smaller libraries that perform the same functions jQuery used to (some would say they do it better but thats more subjective). Since jQuery did everything it needed to include lots and lots of code to implement all its functions, this made the library quite large. For reference, Vue (a popular library used for templating and organizing code today) is 33.3KB compared to jQuery's 214.09 KB. Something like Vue is simply a lot smaller and quicker to download than a dependency like jQuery, especially when you consider that since jQuery does a million things you're probably spending time downloading code you aren't actually using.

 

2) It leads to code that isn't quite as organized as code written using a modern framework. This is a bit subjective but back in the day when jQuery was used for everything it was really on the programmer to organize their code logically. Its not that ALL jQuery dependent js relies on hundreds of lines of pyramid code but a whole lot was. This made it pretty difficult to read js files written at the time, especially as complicated webapp logic became more common and the community at large was not yet proficient at organizing it. These days, popular frameworks (whether you love them or hate them) force structure on your code. For example, if you know what a React Component is you can look at each React Component in a project and not have to wonder what the purpose of all that code is. By contrast, jQuery merely provided you the means to update the UI and make AJAX calls and counted on the programmer to make the actual purpose of the code clear.

 

3) Its older, isn't as "cool", and doesn't give new programmers many good reasons to learn it in a world where there are other options.

 

tldr; jQuery is big, less organized, and generally less desirable than modern alternatives.

 

All that said it isn't BAD to know jQuery. It still performs its function, parts of it can still be useful, and I'm sure a lot of "older" JS is filled with it so for some devs its very important to understand it to this day. I just wouldn't rely too heavily on it with all the other options we have today.

Is jQuery still a good library to use? I've heard that it's been losing popularity. Are there other libraries that are better, or is it better to create my own bases on my own needs?

Remember to quote or @mention others, so they are notified of your reply

AMD Ryzen 9 5950X | Arctic Liquid Freezer II 360 | MSI B450 TOMAHAWK MAX | G.Skill Trident Z RGB 32 GB DDR4-3600 | Gigabyte GeForce RTX 2080 SUPER 8 GB 

Samsung 980 EVO Plus 2TB | SK hynix Gold S31 500GB SSD | Seagate Barracuda Compute 2 TB 7200RPM HDD | 1TB Samsung 860 EVO SSD | 3x Phanteks T30-120

Corsair RM1000e 1000 W 80+ Gold Certified Modular PSU | Corsair 5000D Airflow Windows 11 Home

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, DriedSponge said:

Is jQuery still a good library to use? I've heard that it's been losing popularity. Are there other libraries that are better, or is it better to create my own bases on my own needs?

For general purpose use on "normal" websites it's still super common and good thing to use. If you want to move some tiers up as a JS developer then JS frameworks come into play - ember.js, angular and whatever current year popular framework there is. Like a blog won't use them but like a management panel of a new saas service likely will so it depends where do you fit in.

Link to comment
Share on other sites

Link to post
Share on other sites

jQuery works as well as it ever did today but a whole lot of its use cases have been replaced either by native JS functionality or newer, more specialized libraries. Back when I first began web development around 2014/15 jQuery contained a whole lot of functionality that was pretty critical to a new website or webapp. It was used for making asynchronous calls to external APIs, it had better selectors than normal JS getElementById/Class, it had a weird early form of promises, it was even able to handle basic animations if I remember right.

 

Basically it patched in almost all of the functionality we needed but didn't get from vanilla JS in one library (especially since it was often safer to use jQuery than vanilla JS due to differences between browsers making it likely vanilla JS code behaved differently between browser). It was pretty much an auto-include (along with underscore if you were fancy).

 

Nowadays it still works but there are a couple reasons it isn't the swiss army knife everyone uses for everything.

 

1) To speed up their apps by relying on smaller dependencies than jQuery. There are lots of popular, more specialized, smaller libraries that perform the same functions jQuery used to (some would say they do it better but thats more subjective). Since jQuery did everything it needed to include lots and lots of code to implement all its functions, this made the library quite large. For reference, Vue (a popular library used for templating and organizing code today) is 33.3KB compared to jQuery's 214.09 KB. Something like Vue is simply a lot smaller and quicker to download than a dependency like jQuery, especially when you consider that since jQuery does a million things you're probably spending time downloading code you aren't actually using.

 

2) It leads to code that isn't quite as organized as code written using a modern framework. This is a bit subjective but back in the day when jQuery was used for everything it was really on the programmer to organize their code logically. Its not that ALL jQuery dependent js relies on hundreds of lines of pyramid code but a whole lot was. This made it pretty difficult to read js files written at the time, especially as complicated webapp logic became more common and the community at large was not yet proficient at organizing it. These days, popular frameworks (whether you love them or hate them) force structure on your code. For example, if you know what a React Component is you can look at each React Component in a project and not have to wonder what the purpose of all that code is. By contrast, jQuery merely provided you the means to update the UI and make AJAX calls and counted on the programmer to make the actual purpose of the code clear.

 

3) Its older, isn't as "cool", and doesn't give new programmers many good reasons to learn it in a world where there are other options.

 

tldr; jQuery is big, less organized, and generally less desirable than modern alternatives.

 

All that said it isn't BAD to know jQuery. It still performs its function, parts of it can still be useful, and I'm sure a lot of "older" JS is filled with it so for some devs its very important to understand it to this day. I just wouldn't rely too heavily on it with all the other options we have today.

Link to comment
Share on other sites

Link to post
Share on other sites

On 9/10/2020 at 12:33 AM, endyc said:

jQuery works as well as it ever did today but a whole lot of its use cases have been replaced either by native JS functionality

Yes, exactly. For a newcomer I would say it's easier to find jQuery solution easier than doing it in vanilla or using less "obvious" newer/better library.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×