Live data from Hacker News

Why I'm still using jQuery

arp242.net

21–30 of 246 posts

Re: Why I'm still using jQuery

#21
post #9

If JQuery is all you need to get the job done, go for it. It's still fast, simple and easy to develop. If you need state management, build a very complex app, etc. ... don't.

This is pretty much it in a nutshell. About the only use case where I will look at a framework outside of jQuery is if I want complex state management, or be able to handle LOTS of updating hotspots on the screen.

I'm a proud user of jQuery from way back in the early days, and still haven't found anything to beat it for writing a quick AJAX call to a back end from a web page.

Re: Why I'm still using jQuery

#22
post #9

If JQuery is all you need to get the job done, go for it. It's still fast, simple and easy to develop. If you need state management, build a very complex app, etc. ... don't.

> If you need state management, build a very complex app, etc. ... don't.

I'm not so sure you do for many sites. Take something like Reddit for example; I don't think the new SPA redesign is any better than the old template-driven app. In fact, IMHO it's worse in every way. Part of that is just a matter of design and not technical, but part of it is just "SPA hell": CPU goes to 100% on load, takes ages to load stuff, etc.

On the other hand, I find something like FastMail's web UI to be quite pleasant. So it certainly is possible, but I do think it's a lot harder to get an SPA right than it is to get a classic template-driven app right. It's also a lot more complex, which results in all sorts of problems.

I don't think jQuery is the "perfect" way to develop stuff; the lack of structure means things can get messy (we've all seen that), but I'm not convinced that React is the best answer to that (just because A is imperfect doesn't mean B is the answer, a common fallacy in these types of discussions).

I'm not quite sure what the best way is, and perhaps it already exists and I'm unaware of it, but in the meanwhile I prefer to stick with the "KISS" solution. If I look at the websites I really like using then they're all classic "progressive enhancement" ones, and not SPAs (in fact, FastMail is the only exception that I can think of).

Either way, the post was mainly intended as "vanilla JS vs. jQuery", rather than "classic JS vs. modern SPA" (although they're obviously related discussions).

Re: Why I'm still using jQuery

#24
post #2

What a great article.

You must be new here on HN, we usually like to discuss things instead of calling them names. Mind sharing your opinions instead of just saying it's shitty?

What? I think it's really good!! because it has a lot of good methods and such.

Re: Why I'm still using jQuery

#25
post #16

I didn't know about http://youmightnotneedjquery.com/ , but to me it seems very convincing that I need jQuery :)

Exactly. I know I don't need jQuery, but sometimes it's nice to be able to do stuff like make an ajax request as a one liner vs 10+ lines.

Peoples gripes with jQuery come from people importing the entire library to do one thing, like add a class to an element. Sure, in that case it's dumb to load the entire library for that single purpose. But if you're using it for 5 things? 10 things? It quickly becomes worthwhile.

Re: Why I'm still using jQuery

#27
post #22
post #9

If JQuery is all you need to get the job done, go for it. It's still fast, simple and easy to develop. If you need state management, build a very complex app, etc. ... don't.

> If you need state management, build a very complex app, etc. ... don't. I'm not so sure you do for many sites. Take something like Reddit for example; I don't think the new SPA redesign is any better than the old template-driven app. In fact, IMHO it's worse in every way. Part of that is just a matter of design and not technical, but part of it is just "SPA hell": CPU goes to 100% on load, takes ages to load stuff,…

SPA is by million times better than "classic template-driven" trash. I don't just "think" so, I have 7 years of experience with "classic templates" and 8 years with SPA.

Re: Why I'm still using jQuery

#28

I'm heavily inclined to agree with this. In fact, only this weekend I was working on a very simple one page tool and from the get-go I decided to adopt this "vanilla" only approach, i.e no JS libraries really at all. Pretty quickly I found myself wishing I had just used jQuery or at least some other library to make stuff easier and get things done faster. When I finally got it completed in the end I wasn't sure why I…

So what was the struggle with vanilla js?

I'm just curious :)

One of the first things I learned in web development was jquery but right now I never use it. Even if I create a vanilla html/css/js website.

Re: Why I'm still using jQuery

#29
Sure. But as always. It depends. If you're writing a highly interactive app and your jQuery script starts containing a lot of view state, eventually you'll go mad and probably duplicate a lot of logic on server and client too.

Seeing your app as a function of a data structure/state is then much simpler. Although it will require a bit more thought initially. App = f(s).

Again, it depends. If you're writing static sites and sprinkles will stay sprinkles, jQuery will probably be a solid choice.

Re: Why I'm still using jQuery

#30
post #9

If JQuery is all you need to get the job done, go for it. It's still fast, simple and easy to develop. If you need state management, build a very complex app, etc. ... don't.

It depends what you do with jQuery. Maybe you use a nice , well tested and full featured plugin (calendar, grid view) then jQuery works. Or if you want to manipulate html (you grab an html from a page and you want to export it as epub but you want to remove some stuff before, cleanup some styles, jQuery is much better at DOM manipulation then pure JS)

IMO what you should never do is put your application state inside the DOM if you have a complex page/app.

Post reply on HN