

Ask HN: Why is jQuery everywhere? - jfaucett

I use jQuery extensively and have done so for years now. Its a great lib that's really easy to use so I guess that explains to some degree its pervasiveness ( roughly 50% of top milltion sites according to http://trends.builtwith.com/javascript). But once you get into complex applications it becomes a nightmare - at least in my experience. jQuery UI is very limited and for building enterprise interfaces Dojo and ExtJS blow jQuery out of the water.<p>Is this 50% then everything that's not webapps with complex interfaces? Do any frontend devs actually use jQuery for user interaction (beyond slideshows and the massive amount of plugins)? Has anyone come up with a way to tame jQuery soupe and organize it into something maintainable on large applications?<p>I'd like to know what the community of js developers thinks about this and the future of jQuery, since for the past year or so I've more or less given up on it asside from simple frontend stuff and use almost exclusively Dojo and ExtJS for my apps.
======
munimkazia
That's probably because most websites aren't big javascript applications. They
just use jQuery to add a little interactivity and Javascript into their pages.
I use jQuery almost everywhere, because I am yet to develop a major a major JS
based application.

------
WiseWeasel
I like to use jQuery to animate elements with good cross-browser support, its
syntax for selecting and manipulating elements is more convenient than the
standard method, and jQuery load() and ajax() are extremely convenient.
Combined with Backbone.js and Underscore.js, the sky is the limit, and the
code produced is even relatively readable.

~~~
jfaucett
yes, but pretty much any lib would be easier than manipulating elements with
the standard browser APIs.

I would say that $.ajax has very nice callbacks, error handling and cross-
browser support, and I still think its simplicity is great compared to other
ajax libs out there. But I still don't know if the "sky is the limit" for
jQuery even in combination with Backbone. I mean you "can" probably build
anything with this combo, but then again you can also build a 2000 page
website in pure html - doesn't mean you should or its maintainable, testable,
secure, etc.

------
Piskvorrr
For simple stuff, easy tools are sufficient. And from what I've seen, it's
mostly simple stuff out on the frontends. As you say, there are better
alternatives when you need a complex JS frontend.

------
devgutt
My only reason to use jQuery is to avoid cross-browser js issues.

------
VMG
Look into frameworks like Backbone.js and Knockout.js.

------
dotborg
jQuery reminds me about PHP

~~~
brandoncapecci
In some ways but jQuery is intentionally disorganized. PHP isn't.

~~~
jfaucett
Can you explain why jQuery is intentionally disorganized? Why would any
project be intentionally disorganized?

~~~
brandoncapecci
Functional programming is inherently disorganized. For JavaScript, we make the
best of it since we don't have any alternatives. The hot frameworks right now
ala Backbone sacrifice lines of code for reusability by forcing a design
pattern. In contrast, jQuery doesn't seem to have plans of adding any
organizational abstraction at all (no views, classes, etc). It's intentional
because they have the means to implement these features and choose not to
because doing so would create a much higher barrier for use. They are known as
the easiest to use framework thus their philosophy is to have the easiest
things as easy as possible even if that means making harder things much
harder.

My original comment comes from the idea that JavaScript is forced. One just
makes a choice on a framework. In PHP, most programmers are at minimum going
to take a look at Ruby and Python, both of which are more elegant.

