76

I recently stumbled upon some javascript forums (sadly, link is lost somewhere in the universe), where you could feel real hate against jQuery for not being... any good?

Most arguments seem to make sense actually.

Now, I really like jQuery, mostly for letting me concentrate on things I want to do rather on browser inconsistencies and it actually makes AJAXing with cool (or overused?) effects fun.

But if really is something rotten in the core of jQuery, I don't want to rely on it the way I actually... rely on it.

I don't want to start yet another argument over which framework is the best... but... Which framework is the best (joke)? As a case usage, think about small to medium web and it's administration.

I'm just trying to figure out, if stuff in some framework or pure javascript with few mine functions really makes difference.

Edit:

I actually tried to have a normal objective discusssion over pros and cons of:

  1. Using a framework over pure javascript and
  2. jQuery vs. others,

Since jQuery seems to be easiest to work with with the quickest learning curve. However, some people just don't understand it and think that I'm starting yet another flame (what I am not). I am actually voting to reopen this question.

Also I'm really interested in:

  • Does jQuery heavily rely on browser sniffing? Could that be a potential problem in the future? Why?
  • I found plenty JS-selector engines, are there any AJAX and FX libraries?
  • Is there any reason (besides browser sniffing and personal "hate" against John Resig) why jQuery is wrong?

jQuery actually, as most used, stands for other frameworks also.

12
  • 1
    "I don't want to start yet another argument over which framework is the best", ". Which framework is the best? " what?.. Commented Feb 26, 2010 at 8:55
  • 1
    @Jimmy - yes but mostly you always see one point - on jQuery friendly sites jQuery ftw, on some js forums jQuery sucks, you never see the comparison side by side
    – Adam Kiss
    Commented Feb 26, 2010 at 8:55
  • 3
    It's subjective, argumentative and should be, if not closed, commuity wiki. Commented Feb 26, 2010 at 8:57
  • 1
    @Filip stating something and condradicting it... it was meant a bit as a joke... nevermind >.<
    – Adam Kiss
    Commented Feb 26, 2010 at 8:58
  • 2
    @Adam I read it. I understand that you're not trying to start a flame war. Read what I wrote. I did not say you were. I am saying this is redundant and unnecessary.
    – Jimmy
    Commented Feb 26, 2010 at 18:59

6 Answers 6

42

It's all about performance and development speed. Of course, if you are a good programmer and design something that is really tailored to your needs, you might achieve better performance than if you had used a Javascript framework. But do you have the time to do it all by yourself?

My personal opinion is that Javascript is incredibly useful and overused, but that if you really need it, a framework is the way to go.

Now comes the choice of the framework. For what benchmarks are worth, you can find one at http://ejohn.org/files/142/ . It also depends on which plugins are available and what you intend to do with them. I started using jQuery because it seemed to be maintained and well featured, even though it wasn't the fastest at that moment. I do not regret it but I didn't test anything else since then.

3
  • well exactly my thoughs (for now), but claims about how jQuery is doing everything wrong in the "corest" core and evaluating browsers and stuff... got me confused
    – Adam Kiss
    Commented Feb 26, 2010 at 9:05
  • 1
    jQuery is not a framework, it's a utility library.
    – Val Kornea
    Commented Feb 23, 2018 at 14:34
  • Now, maybe. Nearly 10 years ago, things were a bit different :)
    – Xr.
    Commented Feb 24, 2018 at 10:26
29

Personally i think you should learn the hard way first. It will make you a better programmer and you will be able to solve that one of a kind issue when it comes up. After you can do it with pure JavaScript then using jQuery to speed up development is just an added bonus.

If you can do it the hard way then you can do it the easy way, it doesn't work the other way around. That applies to any programming paradigm.

11

jQuery like any other good JavaScript frameworks supplies you with functionality independent of browser platform wrapping all the intricacies, which you may not care about or don't want to care about.

I think using a framework is better instead of using pure JavaScript and doing all the stuff from scratch, unless you usage is very limited.

I definitely recommend jQuery!

3
  • I already work with jQuery, I was more interested in arguments why it's better (putting "ease of use" aside)
    – Adam Kiss
    Commented Feb 26, 2010 at 9:09
  • 1
    Because of its elegance and continuous new features, at least I haven't seen any JavaScript framework that has this rapidly growing community of users and support. Thanks Commented Feb 26, 2010 at 10:52
  • 3
    @Greg: I didn't understand you comment. Did I use Elegance in the wrong context? Commented May 6, 2011 at 9:41
10

"I actually tried to had a normal objective discusssion over pros and cons of 1., using framework over pure javascript and 2., jquery vs. others, since jQuery seems to be easiest to work with with quickest learning curve."

Using any framework because you don't want to actually learn the underlying language is absolutely wrong not only for JavaScript, but for any other programming language.

"Is there any reason (besides browser sniffing and personal "hate" against John Resig) why jQuery is wrong?"

Most of the hate agains it comes from the exaggerated fanboyism which pollutes forums with "use jQuery" as an answer for every single JavaScript question and the overuse which produces code in which simple statements such as declaring a variable are done through library calls.

Nevertheless, there are also some legit technical issues such as the shared guilt in producing illegible code and overhead. Of course those two are aggravated by the lack of developer proficiency rather than the library itself.

8
  • Does jQuery heavily rely on browser sniffing? Could be that potential problem in future? Why?

No - there is the $.browser method, but it's deprecated and isn't used in the core.

  • I found plenty JS-selector engines, are there any AJAX and FX libraries?

Loads. jQuery is often chosen because it does AJAX and animations well, and is easily extensible. jQuery doesn't use it's own selector engine, it uses Sizzle, an incredibly fast selector engine.

  • Is there any reason (besides browser sniffing and personal "hate" against John Resig) why jQuery is wrong?

No - it's quick, relatively small and easy to extend.

For me personally it's nice to know that as browsers include more stuff (classlist API for example) that jQuery will update to include it, meaning that my code runs as fast as possible all the time.

Read through the source if you are interested, http://code.jquery.com/jquery-1.4.3.js - you'll see that features are added based on the best case first, and gradually backported to legacy browsers - for example, a section of the parseJSON method from 1.4.3:

return window.JSON && window.JSON.parse ?
    window.JSON.parse( data ) :
    (new Function("return " + data))();

As you can see, if window.JSON exists, the browser uses the native JSON parser, if not, then it avoids using eval (because otherwise minfiers won't minify this bit) and sets up a function that returns the data. This idea of assuming modern techniques first, then degrading to older methods is used throughout meaning that new browsers get to use all the whizz bang features without sacrificing legacy compatibility.

1
5

Jquery VS javascript, I am completely against the OP in this question. Comparison happens with two similar things, not in such case.

Jquery is Javascript. A javascript library to reduce vague coding, collection commonly used javascript functions which has proven to help in efficient and fast coding.

Javascript is the source, the actual scripts that browser responds to.

5
  • 2
    In my opinion, who wants to understand the question, understands it. The point stated here was, whether jQuery is worth of implementing, or whether a programmer should go with clean JavaScript. Commented Sep 6, 2012 at 20:11
  • @Bunkai.Satori, Which basically asks of jQuery vs Javascript type answer.
    – Starx
    Commented Sep 7, 2012 at 0:27
  • @Tiberiu-IonuțStan, Or many lines of codes for a simple action.
    – Starx
    Commented Jun 2, 2013 at 1:54
  • 1
    In my opinion, the central problem with JQuery is that while it has increased ease of development, there is a disturbingly large number of people who think that JQuery is a seperate language, an alternative to Javascript. Hence the eye-twitching question title...and, hence lots of poorly-written code that doesn't quite understand how the DOM / JQuery / Javascript operate.
    – Katana314
    Commented Aug 7, 2013 at 19:32
  • 1
    @Katana314, I agree. A popular library such as jQuery is an misconception of a language. Sadly, even in job application you see, JavaScript and jQuery expert. Another example is Ruby on Rails which is very close to an exception but still not a different language. To say the least it is common mistakes by rookies. Once their code goes to enterprise level they will learn to code in clean javascript.
    – Starx
    Commented Aug 8, 2013 at 3:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.