Live data from Hacker News

I loved jQuery, and still do (2019)

withblue.ink

161–170 of 189 posts

Re: I loved jQuery, and still do (2019)

#161

Django templates + Bootstrap + jQuery is all I've ever needed to make great, modern websites. Server-side rendering with some nice layouts and interactivity on the frontend. I've tried some of the SPA frameworks and I've always felt like my productivity tanked.

In General I agree, but using a SPA framework has one major benefit. It forces you to make an API for everything. So when a request comes in to make something more dynamic you have everything you need ready to go. Also, if you're building an app that some users need API access for, it's already there. I daydream about making a framework that lets me use django templates as a SPA that does server side rendering on the…

> using a SPA framework has one major benefit. It forces you to make an API for everything.

This is a drawback unless you truly need an API. YAGNI.

I've found a hybrid approach works well. Your site is mostly server side, but some individual pages have Vue and an API endpoint or two. If that mobile app or that third-party integration becomes a need, add endpoints for that particular use case.

I've gone the other route and prematurely optimized for the "what ifs" first, and it's painful when they don't happen and you're left holding all that complexity.

Re: I loved jQuery, and still do (2019)

#163
It's really a great piece of engineering -- it a technical building block that is very well designed and solves a great number of problems. Some of the things that came later put development on a new level, but this doesn't take anything away from jQuery for the time it was made. Resig's book is in a large part "how jQuery was made" and it was a great read. Also some of the built in APIs that mimicked it like querySelector are not as elegant as jQuery, even though it was a solved problem at that point.

Re: I loved jQuery, and still do (2019)

#164

I had a big post but deleted it all. I can more concisely say this: The people here saying they still use it have so far demonstrated what I always say. If you're using jQuery, it's time to go back and relearn javascript. Most people should REALLY research the querySelector and querySelectorAll DOM methods. I've always felt that jQuery encourages you to let your skills stagnate and you don't learn what your code is a…

> Most people should REALLY research the querySelector and querySelectorAll DOM methods.

Query selectors are like slow motion drowning in syrup. They are so astonishingly slow. They are also limited in what they can do.

Just learn the DOM. It can be learned in a single afternoon but for some reason people will fight you to death on this and then stake their careers on it like a heroic battle that nobody cares about.

Re: I loved jQuery, and still do (2019)

#165
post #45

I still use jQuery even for new projects. Yes, these days it's possible to do everything jQuery does using native JS, but I find the native version to be much more verbose and its naming conventions to be far less clear. For example, natively getting a list of children is `el.children` but natively getting the parent is `el.parentNode`, not `el.parent`. Meanwhile, natively getting a list of classes is `el.classList`,…

You can just assign document.QuerySelector and document.QuerySelectorAll to $ and $$ yourself.

Re: I loved jQuery, and still do (2019)

#166

Earlier quoted context omitted.

Sounds like you're working on jQuery-sized apps, not React-sized. The problem is that many don't know the difference, and everything is React-sized, even apps that have no business being anything but server-rendered.

Yep... I mean, part of that is a problem of "SPA everything" cargo cult; basic web page? SPA everything! Content management? SPA everything! I manage my wife's electronic store that's based on WordPress, and I see absolutely no reason for ever changing it. I've written a bunch of custom scripts, all in PHP back-end and jquery front-end, and... It just works. And it's fast. And complexity is totally manageable. But, I…

The software I manage is a very complex asynchronous workflow engine sometimes spanning across hundreds of containers. It's our bread and butter.

Our marketing site is in Wordpress.

Re: I loved jQuery, and still do (2019)

#167
post #5

jQuery is still my bread and butter for DOM manipulation and events. I've found it to be much more readable than vanilla JS.

That's 30KB over the network and 90KB of JS code in memory so that you don't need to learn about 5 standardized browser API methods that are the same in every browser going back to IE9 then. No doubt that gives you a better developer experience but I don't think your users are thanking you.

Who cares when you're slurping down 40 megapixel PNGs for images that are sized with CSS to 100px x 100px?

Re: I loved jQuery, and still do (2019)

#168

I finally learned some React a couple of months ago on the premise that as a designer, I needed a better understanding of the frameworks used by the developers I work with. I know React enforces some better practices that my spaghetti-jQuery of yore never followed, and that I was getting a crash course in those practices at the same time, but I was nonetheless surprised at just how slow I felt working in it! It gave…

Note that you may have this opinion because you started with jQuery first, and you're already familiar with it. Some things are not at all intuitive for beginners in jQuery, either.

Re: I loved jQuery, and still do (2019)

#169

Earlier quoted context omitted.

I assume that's a pro-jquery site I write random bits of scripts for internal use, I'm happy enough to drop the min.js in with my index.js, index.css and index.php files, especially if it means I can continue to use getJSON('/my/url', function(data) { }); Rather than var request = new XMLHttpRequest(); request.open('GET', '/my/url', true); request.onload = function() { if (this.status >= 200 && this.status The 90KB o…

You could have used async/await and fetch along with a polyfill if you are concerned about compatibility with older browsers. ;-)

Maybe that's just me but I find the async/await stuff way harder to understand than a simple callback. Sure when you're going through callback hell you're glad to have promises and the syntaxic sugar, but for simple things the callback makes sense, especially since it's already how you use map and filter in JS.

Re: I loved jQuery, and still do (2019)

#170
post #101

Earlier quoted context omitted.

If it's a corporate environment, the standards are different, understandably. But the hostility to jQuery is also primarily concentrated among corporate devs that seemingly cannot imagine that jQuery might be valuable for use cases other than their own. Not every site out there is an database-driven SPA that needs QA review and a deployment pipeline each time an update is made. Lots of sites are just simple WordPress…

> little bit of a facelift Proceeds to download 30kb (compressed) swiss army knife of a library when just a toothpick would do. jQuery is about as much of a gateway to ES6 as pot is to heroin. Devs who still use jQuery have had 10+ years to learn `document/element.querySelectorAll()`. Longer for event listeners.

> Proceeds to download 30kb (compressed) swiss army knife of a library when just a toothpick would do.

I agree that 30kb can be big, especially since it's JS that needs to be executed, but on the other hand if the toothpick means you save a minute, you can use it to optimize an image and end up with a lighter and faster website.

Post reply on HN