12 ms·
> but it seems many developers frown upon it these days This is sadly very true. jQuery is almost used as an insult these days. Having code be called "jQuery
by freedomben 8y ago
> but it seems many developers frown upon it these days
This is sadly very true. jQuery is almost used as an insult these days. Having code be called "jQuery Spaghetti" is about the worst epithet that can be hurled at a javascript codebase these days.
- underwater 8y agojQuery is great for small snippets of code, but encourages a quick and dirty style that collapses for larger applications. Most jQuery applications couple their business logic to the mechanics of working with the DOM. It was also intended to smooth over browser inconsistencies and gaps in APIs. This is less relevant these days now that browsers are more mature.
- rhapsodic 8y ago> jQuery is great for small snippets of code, but encourages a quick and dirty style that collapses for larger applications. I keep hearing (well, reading on HN) criticisms of this sort about jQuery and they are absolutely not supported by the years of experience I have using jQuery for front-ends that have in many cases been quite complex. I use it because it greatly simplifies DOM manipulation and event handling. (e.g., no need to remove event handlers for a subtree removed by the .remove() method.)
- underwater 8y agoIn my experience the app tends to evolve around jQuery selectors and event handlers, rather than having a well defined structure. This is not a fault of jQuery, as it never intended to solve those problems. Like you said, it is purely meant to solve the DOM issue.
- rhapsodic 8y ago>In my experience the app tends to evolve around jQuery selectors and event handlers, rather than having a well defined structure What does that even mean?
- DaiPlusPlus 8y agoCSS selectors are highly dependent on the structure of your HTML. If you refactor your HTML then you’ll be required to rewrite many of your CSS selectors. None of that is surprising at all, but jQuery makes it hard to abstract the use of CSS selectors away from the rest of your UI code. Compare with Angular2+ where the logical separation of Components and the HTML of the template is rigidly enforced making refactoring and “scaling” considerably easier. jQuery is library that provides DOM shorthand - it isn’t a true application framework.
- rhapsodic 8y ago>If you refactor your HTML then you’ll be required to rewrite many of your CSS selectors. I haven't found that to be a major issue. And I don't think the term "refactor" is the best choice here. jQuery is library that provides DOM shorthand - it isn’t a true application framework. Of course not. I don't want a third-party application framework. I discovered years ago that they're not worth the extra effort or the technical debt one incurs with them. (At least not to me. I'm not telling anyone what they should think or that they should design their applications like I do.) My approach for me and the developers on my team is to develop a deep level of understanding of HTML, CSS and JS. Once you have that, the prospect of doing things for yourself that frameworks would otherwise provide does not seem all that daunting. To me, frameworks like React, Angular, etc. don't reduce complexity, they increase it. And I hasten to note that I realize that many bright, capable people hold a different view , and I'm not saying they're wrong.
- eropple 8y agoSomething like React isn't even an application framework, though, it's a view library of compositional functions feeding into a tree diff. How does functional, side-effect-free code increase complexity? What makes your side-effecting code more testable and verifiable than unambiguous in/out functional transforms?
- digitalzombie 8y ago
- quxbar 8y agoThe fact that you're keeping track of your actual DOM and event handling at all? That's what I got sick of. Going from jQuery to React was a huge breath of fresh air.
- rhapsodic 8y ago> The fact that you're keeping track of your actual DOM and event handling at all? That's what I got sick of. Not me. I call it "writing software."
- Fifer82 8y agoI am one of those people. It isn't that I don't understand it's purpose. What I hate is when people like my boss, who haven't read a text book on the subject for 13 years pull Jquery out automatically and force it into everyones face before any actual purpose for doing that is established. It really winds me up.
- freedomben 8y agoWe can definitely agree on that. I tend to think about what the actual JS needs will be. If it's going to be relatively simple then I can hack it together in lighting speed in jquery and it stays easy to work on. If the complexity is going to be higher or needs to do more than a few fetches or xhr calls, it's time to consider something else like React.
- tracker1 8y agoFavorite development manager quote that I ever heard a manager say. "Why are you guys talking about JavaScript? Can't you just use jQuery?"