Live data from Hacker News

Why I'm still using jQuery

arp242.net

61–70 of 246 posts

Re: Why I'm still using jQuery

#61
post #33

> In my experience server-side generated templates lightly sprinkled with “progressive enhancement”-style JavaScript are still the best way to do that. Those apps are easier to develop, tend to be faster, tend to have fewer bugs, and your laptop’s fan won’t wake the neighbours. Thanks for that part. Really. A heartfelt thank you. Every time I see another "hey, I only want to show you text, but for some reason I thoug…

Has it occured to you you might simply not understand the advantages of this approach? There's a lot of crazy things in the world. Talk to a child about the economy or country borders and you'll realize how some things are just not straightforward to explain the advantages of. Serverside rendering in JS is no different to SSR in classic frameworks. You generate HTML serverside. Except in this case, you do it using Ja…

I'm an old php dev, still doing server side development exclusively, and these are genuine questions: 1. What tooling is there available? Do you mean something along the lines of vim or IntelliJ? 2. How do these techniques make the user experience better, compared to e.g. ajax?

Re: Why I'm still using jQuery

#62
> Pages like You might not need jQuery try to sell the idea that it’s easy to ditch jQuery[...]

I wasn't aware of http://youmightnotneedjquery.com/, but that's an inaccurate summary of what the website tries to do and really does it a disservice.

It very specifically says, in the first sentence on the site, that you should use jQuery for regular development - it's specifically talking about people developing libraries, and encouraging them to not force other people to load jQuery as an extra dependency, which is a very reasonable position. And I don't think it's trying to sell how easy plain JS is, as much as just giving translation code from common jQuery code to plain code, so that if you want to go that route, it'll be easier to do so!

Here, I'll just quote the first text on the page (emphasis mine):

"jQuery and its cousins are great, and by all means use them if it makes it easier to develop your application.

If you're developing a library on the other hand, please take a moment to consider if you actually need jQuery as a dependency. Maybe you can include a few lines of utility code, and forgot the requirement. If you're only targeting more modern browsers, you might not need anything more than what the browser ships with."

Re: Why I'm still using jQuery

#63
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,…

With the way Reddit tries to shove it's app down your throat while using their SPA the cynic in me wonders if it's not designed to be as painful as possible if you persist. The last time I tried, I got THREE separate UI components prompting me to use the app.

Re: Why I'm still using jQuery

#64
post #52
post #28

Earlier quoted context omitted.

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.

Not really a struggle, but why would you want to type ten lines when two will do?

Isn't that different reduced a lot with ES6+? By adding jQuery load time increase by almost a second or two

Re: Why I'm still using jQuery

#65
post #33

> In my experience server-side generated templates lightly sprinkled with “progressive enhancement”-style JavaScript are still the best way to do that. Those apps are easier to develop, tend to be faster, tend to have fewer bugs, and your laptop’s fan won’t wake the neighbours. Thanks for that part. Really. A heartfelt thank you. Every time I see another "hey, I only want to show you text, but for some reason I thoug…

Has it occured to you you might simply not understand the advantages of this approach? There's a lot of crazy things in the world. Talk to a child about the economy or country borders and you'll realize how some things are just not straightforward to explain the advantages of. Serverside rendering in JS is no different to SSR in classic frameworks. You generate HTML serverside. Except in this case, you do it using Ja…

> If it were, developers would not be flocking en masse towards SPAs and the like.

Argumentum ad populum. That's not an indicator of something being better. I do like using the modern SPA frameworks for well, (web)apps but I strongly disagree with using them in every case.

Re: Why I'm still using jQuery

#66
post #16

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

Small detail, what's with the plus in this code from that site:

    last = +new Date();

Re: Why I'm still using jQuery

#67
I’m pretty much in agreement with this, to a point. jQuery is a reliable and fast way to make a age do just about anything, except maintaining state.

The KISS principle is practically unheard of in web development lately - I see teams using more “hip” technologies like React or Angular for simple sites, but then the complexity of the app increases considerably for not that much in the way of gains. Sometimes simpler really is better

Re: Why I'm still using jQuery

#68
post #33

> In my experience server-side generated templates lightly sprinkled with “progressive enhancement”-style JavaScript are still the best way to do that. Those apps are easier to develop, tend to be faster, tend to have fewer bugs, and your laptop’s fan won’t wake the neighbours. Thanks for that part. Really. A heartfelt thank you. Every time I see another "hey, I only want to show you text, but for some reason I thoug…

Has it occured to you you might simply not understand the advantages of this approach? There's a lot of crazy things in the world. Talk to a child about the economy or country borders and you'll realize how some things are just not straightforward to explain the advantages of. Serverside rendering in JS is no different to SSR in classic frameworks. You generate HTML serverside. Except in this case, you do it using Ja…

> Has it occured to you you might simply not understand the advantages of this approach?

I find it pretty rude to use the "you don't like it because you don't understand it" argument. I build SPAs at work, I know their benefits, and I still believe that they're more difficult to develop than adding JS on top of classic HTML (not saying they're worse, but certainly I don't find them easier).

> So when the author says that classic HTML with sprinkled js on top is "easier to develop", I smirk. If it were, developers would not be flocking en masse towards SPAs and the like. Those are gaining traction because they are easier to develop and easier to maintain.

I'd say that we, developers, often move to overcomplicated and difficult tools/approaches. Or we move to tools that are simple only to see them grow in size and complexity. The fact that something becomes popular doesn't mean that it's necessarily better or easier to maintain.

Re: Why I'm still using jQuery

#69
Something seldom considered while discussing the use of libraries and frameworks: green computing.

Mind that you're multiplying any overhead thousandfold or even millionfold when transferring the overhead to each client connecting to the service (including several instances of network infrastructure). So,"how much effort it can be to use vanilla JS", – it may be well worth the extra effort, once, on a single side of the communication chain.

Re: Why I'm still using jQuery

#70
post #52
post #28

Earlier quoted context omitted.

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.

Not really a struggle, but why would you want to type ten lines when two will do?

There are a lot of answers to that question, but they all summarize down to: you are the developer not the user.

* Perhaps those 10 lines execute faster

* Perhaps those 10 lines are exactly 10 lines, where jQuery is 2 lines plus a 65k library

* Perhaps those 10 lines work equally in multiple environments (node, deno, electron, browser) where jQuery does not.

* Perhaps those 10 lines sit behind a custom abstraction that actually looks like a single method

* Perhaps those 10 lines do something jQuery does not

* Perhaps those 10 lines scale and extend in ways jQuery does not

* Perhaps those 10 lines have a desired side effect

Post reply on HN