Live data from Hacker News

You might not need jQuery (2014)

youmightnotneedjquery.com

161–170 of 241 posts

Re: You might not need jQuery (2014)

#161
I bought into this a few years ago and ended up regretting it. My code has become much harder to maintain and read due to all the extra boilerplate code, and it probably has hidden bugs and compatibility issues that I'm not even aware of. And for some things I still ended up requiring jQuery, because they just weren't feasible to do in vanilla JS.

I have actually gone back to making heavier use of jQuery again these days.

Re: You might not need jQuery (2014)

#162
post #23

Having used react and redux for several years now, I'm a bit burnt out on how bloated and silly the entire front end has become. If I could decide for myself, I probably would use raw DOM or jQuery at this point.

"has become"? So will you be using Backbone + Marionette, or one of the other MVC frameworks? Which jQuery plugins will you be needing? Will you be using Require.js, or are you just going to have a big list of script tags? What about Bower? What about backwards compatibility and dependency management and other really boring things? If you have a very simple client that "just" uses the DOM APIs or an abstraction over a subset of those (ie jQuery), where have you shifted the complexity to?

Sorry to pick on your post over the million and one other ones that pop every time jQuery gets mentioned in HN (same for the "look at my my blog website that just uses HTML/CSS" posts), but why is it silly? There's no halcyon period where it was simpler and easier, and the tools are in general much better than they were.

Re: You might not need jQuery (2014)

#163
post #149

Earlier quoted context omitted.

If you dislike promises, what do you prefer? Callbacks? Why?

Because it's a lot clearer what gets run in what order.

How? It's about the same if you have one callback maybe, but as soon as you have a callback within a callback - or worse, want to do something involving the results of more than one callback - I just can't see it. What's the advantage of what's often referred to as "callback hell" for you?

Re: You might not need jQuery (2014)

#164
I miss jQuery. It's funny that an argument against jQuery is "oh, but you have to load that big thing to access your site", but then we'll create Single Page Apps that then proceed to spend loading json for 10 seconds before we start interacting with them. :)

Re: You might not need jQuery (2014)

#165
post #8

It's ironic that there's probably no bigger sales pitch for jQuery than this site. In every single example, the jQuery version is basically one or two lines of code, versus 10-15 lines for the alternative. (and the jQ version seems significantly easier on the eyes as well.) Also, jQuery supports promises and has for quite a while. This page hasn't aged well. I've come full circle and am now using jQuery again.

This comment is a great example of what I call "lines of code mindset" which is form of tip of the iceberg mentality, where programmers optimize for simplicity only the code they see. Is saving 10-15 lines worth it if you need an 86.1 Kb vendor dependency? Hidden complexity you don't control is the most expensive kind I think.

A vendor dependency that's almost certainly locally cached already if you use one of the common CDNs for serving jQuery - ajax.googleapis.com, cod.jquery.com, cdnjs.cloudflare.com or cdn.jsdelivr.net.

Re: You might not need jQuery (2014)

#166
post #8

It's ironic that there's probably no bigger sales pitch for jQuery than this site. In every single example, the jQuery version is basically one or two lines of code, versus 10-15 lines for the alternative. (and the jQ version seems significantly easier on the eyes as well.) Also, jQuery supports promises and has for quite a while. This page hasn't aged well. I've come full circle and am now using jQuery again.

This comment is a great example of what I call "lines of code mindset" which is form of tip of the iceberg mentality, where programmers optimize for simplicity only the code they see. Is saving 10-15 lines worth it if you need an 86.1 Kb vendor dependency? Hidden complexity you don't control is the most expensive kind I think.

> Is saving 10-15 lines worth it if you need an 86.1 Kb vendor dependency?

There's projects like https://umbrellajs.com/ which are very similar to jquery's APIs for DOM manipulation and it's only 2.5kb gzipped.

IMO it's a nice balance between having a convenient API without bringing in the world.

If I could write 2-5x less code and it's easy to remember I would make that trade off every time.

Re: You might not need jQuery (2014)

#167
post #8

Earlier quoted context omitted.

This comment is a great example of what I call "lines of code mindset" which is form of tip of the iceberg mentality, where programmers optimize for simplicity only the code they see. Is saving 10-15 lines worth it if you need an 86.1 Kb vendor dependency? Hidden complexity you don't control is the most expensive kind I think.

A vendor dependency that's almost certainly locally cached already if you use one of the common CDNs for serving jQuery - ajax.googleapis.com, cod.jquery.com, cdnjs.cloudflare.com or cdn.jsdelivr.net.

Browsers are now separating out caches per origin so that benefit has gone away.

Re: You might not need jQuery (2014)

#168

Someone should make a youmightnotneedspringboot.com

I'm less interested in what people are running their backend on because that tends not to be where performance issues with sites lie.

That's funny.

The RoR folks asked the HAProxy developer to add a feature to only direct one request at a time to RoR servers - because it's that inefficient. :)

Not to be outdone though, microservice operators have influenced HAProxy to help manage short-lived hosts, sometimes in the subsecond lifetime range.

Re: You might not need jQuery (2014)

#170
post #23

Having used react and redux for several years now, I'm a bit burnt out on how bloated and silly the entire front end has become. If I could decide for myself, I probably would use raw DOM or jQuery at this point.

I think it really depends on the size and type of the app.

As someone who worked on large jQuery apps before React, I think most people would jump back into React or Vue in the first chance after seeing a non-trivial jQuery app. Not to mention there was a lot of "bloat" in those apps, too: Backbone, Bootstrap, Moment.js...

jQuery was amazing for small things, for landing pages, for some Bootstrap components here and there, and for sprinkling the page with progressive-enhanced features. And it still is probably the best choice.

But it was not a great fit for moderate-to-large apps. And it was a terrible fit for moderate-to-large apps that only consumed data from an API.

Not saying React and Redux are good, but I think at least the parts of React, Angular and Vue that replaced jQuery were definitely a step in the right direction.

I'm also not saying that "big apps" are the way to go. If I could I would go back to server-side rendered HTML and modern CSS, but it has become hard to find developers that are into it.

Post reply on HN