JQuery- Do developers need it?

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

36 Replies - 743 Views - Last Post: 05 February 2014 - 07:20 AM

#1 rikkp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 26-March 12

JQuery- Do developers need it?

Posted 30 January 2014 - 09:10 AM

I have been a web developer for about 8 years and have worked for CitiStreet, Brown University, Assumption college and many others. Can anyone explain to me, why most job postings ask for experience with JQuery? I have yet to figure out what it can do for me when developing business wedsites that I haven't been able to do for the last eight years?
Is This A Good Question/Topic? 0
  • +

Replies To: JQuery- Do developers need it?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8365
  • View blog
  • Posts: 31,080
  • Joined: 12-June 08

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 09:28 AM

Ultimately it makes javascript suck less, and has a whole mess of great plugins.

http://blogs.msdn.co...so-popular.aspx
http://www.1stwebdes...look-at-jquery/
http://blog.teamtree...ascript-library
http://www.linkedin....487.S.221076554
Was This Post Helpful? 0
  • +
  • -

#3 rikkp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 26-March 12

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 09:42 AM

OK, can you give me an example?
What have you use javascript to accomplish on a company website in the past and how does using Jquery make that same javascript task easier to accomplish?
THANKS
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8365
  • View blog
  • Posts: 31,080
  • Joined: 12-June 08

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 09:53 AM

Example abound everywhere.. again - a quick search provides a treasure trove:

http://www.awwwards....ebsites/jquery/
http://www.onextrapi...website-design/
http://net.tutsplus....uses-of-jquery/


Is this a question of javascript of jquery?
Was This Post Helpful? 0
  • +
  • -

#5 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 403
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 09:59 AM

Ajax would be a prime example.

jQuery post request via ajax
$.post("url/to/go/to.php", SendDataObj,function(data){
  //do stuff with data that is returned
});



Javascript post request via ajax

(function() {
  var httpRequest;
  document.getElementById("ajaxButton").onclick = function() { makeRequest('test.html'); };

  function makeRequest(url) {
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
      httpRequest = new XMLHttpRequest();
    } else if (window.ActiveXObject) { // IE
      try {
        httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch (e) {
        try {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        } 
        catch (e) {}
      }
    }

    if (!httpRequest) {
      alert('Giving up :(/> Cannot create an XMLHTTP instance');
      return false;
    }
    httpRequest.onreadystatechange = alertContents;
    httpRequest.open('GET', url);
    httpRequest.send();
  }

  function alertContents() {
    if (httpRequest.readyState === 4) {
      if (httpRequest.status === 200) {
        alert(httpRequest.responseText);
      } else {
        alert('There was a problem with the request.');
      }
    }
  }
})();



This is just the tip if the capabilities of jQuery.
Was This Post Helpful? 1
  • +
  • -

#6 ArtificialSoldier  Icon User is offline

  • D.I.C Addict


Reputation: 199
  • View blog
  • Posts: 690
  • Joined: 15-January 14

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 10:09 AM

Any framework is going to be slower than just writing the Javascript yourself, but the frameworks exist to make common tasks faster to program (not faster to execute, though).
Was This Post Helpful? 1
  • +
  • -

#7 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3635
  • View blog
  • Posts: 5,756
  • Joined: 08-June 10

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 10:53 AM

laytonsdad, your native code is in fact just a GET request. A POST request would have to encode the body into the send call, and set the proper header, making it even more elaborate than that.


I'm also not sure I can agree with you, ArtificialSoldier. Frameworks like jQuery are extremely streamlined for efficiency, being backed by a large community of developers.

I'm sure you could shave a few nanoseconds of the execution time for a particular scenario by tailor fitting a solution to that situation, but it would no doubt be negligible. Not to mention that, depending on the skill level of the developer, I'd say it's far more likely that said developer lacks the skill to achieve that.

Quote

Can anyone explain to me, why most job postings ask for experience with JQuery?

Taking the merits of jQuery out of the equation, the fact is that jQuery is used all over the place. It's extremely widespread throughout the internet. If you're working on web-dev projects that you didn't design yourself, you'll very likely have to deal with jQuery code at some point. - I can understand companies wanting to ensure that potential employees are familiar with the library.

Luckily it's a pretty trivial matter to learn the basic use of jQuery. Especially for people with extensive experience using native Javascript.
Was This Post Helpful? 1
  • +
  • -

#8 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 403
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 11:05 AM

Thanks Atli for the catch.
Was This Post Helpful? 0
  • +
  • -

#9 ArtificialSoldier  Icon User is offline

  • D.I.C Addict


Reputation: 199
  • View blog
  • Posts: 690
  • Joined: 15-January 14

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 11:21 AM

Quote

I'm also not sure I can agree with you, ArtificialSoldier. Frameworks like jQuery are extremely streamlined for efficiency, being backed by a large community of developers.

The good thing about facts is that they don't require agreement. Something like jQuery undergoes quite a bit of optimization for sure, but it can't compete with the native methods. jQuery adds a lot of power, in terms of things like selecting groups of elements, but that power comes at a decrease in speed. I'm sure there are certain things that jQuery can do basically just as fast as native Javascript, but if you think about it, it is not possible for jQuery to be faster than native Javascript. The only direction they can go is down.

There's a selector benchmark summary here that shows some of this. e.g.:

Quote

var c = $(".comment"); 3,437 ms
var c = document.getElementsByClassName("comment"); 75 ms


That's over 10,000 iterations, so like you pointed out the real difference is likely to be virtually unnoticeable unless your code is absolutely hammering the DOM. But, like with any other framework that is written using the same language that it's for, the only direction to go with regard to performance is down. They can't make jQuery do anything faster than is possible with native JS.

Other than selecting DOM nodes, I imagine that some of the algorithms that they use to do some of the more complex tasks (e.g. animation) are probably better optimized then the equivalent algorithms that you or I would come up with. But, then again, I could probably write an algorithm for a specific animation that would perform better than their general-purpose animation algorithms. But when we're talking about animation, since those steps will typically fire off each tens or hundreds of milliseconds, as long as the step takes less time then the wait until the next step then it doesn't matter much how much faster it would be.

I probably should have referenced Vanilla-JS here also.

This post has been edited by ArtificialSoldier: 30 January 2014 - 11:25 AM

Was This Post Helpful? 0
  • +
  • -

#10 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 403
  • View blog
  • Posts: 1,720
  • Joined: 30-April 10

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 12:40 PM

Quote

I could probably write an algorithm for a specific animation that would perform better than their general-purpose animation algorithms


This doesn't make much sence to me, why would you want to write a new algorithm for every animation instance sacrificeing your devlopment time for a few ms for the user that will not even care that you put in all that time?
Was This Post Helpful? 0
  • +
  • -

#11 ArtificialSoldier  Icon User is offline

  • D.I.C Addict


Reputation: 199
  • View blog
  • Posts: 690
  • Joined: 15-January 14

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 02:17 PM

I wouldn't do that, I'm just saying it's probably possible. I'm sure jQuery's animation algorithms are pretty optimized, but since they have to be general-purpose they may lose a little in a competition against a special-purpose animation algorithm. I wouldn't spend my time writing that though, I just think that the benefit of using something like jQuery is entirely in development time, and not in performance or computational efficiency.

Another great example of that is WordPress. WordPress is great to set up a site that looks pretty good in a short time. But again, the tradeoff is performance and efficiency. I'm helping a friend with some of her clients' sites and the home pages for them typically ask for around 150 requests, including over 40 requests each for Javascript and CSS. WordPress makes it easy for her to set that site up, but it's a hog on performance with all of the themes and plugins and things each requiring their own sets of external resources. Again, it would be possible to build that site in such a way that it basically shows the same information but does it far more efficiently (i.e., 1 minified Javascript file, and 1 CSS file), but the tradeoff for that is a ton of extra development time.

I'm just saying that I don't think any good developer has ever said "my website is running too slowly, I'm going to add jQuery to speed it up."

This post has been edited by ArtificialSoldier: 30 January 2014 - 02:19 PM

Was This Post Helpful? 0
  • +
  • -

#12 blankwavercade  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 115
  • Joined: 13-December 11

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 05:55 PM

I'll just leave this here. It's surprising how little you actually need.
http://youmightnotneedjquery.com/
Was This Post Helpful? 1
  • +
  • -

#13 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2875
  • View blog
  • Posts: 9,542
  • Joined: 12-December 12

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 07:37 PM

That's a very good link.

It bugs me on other forums when people ask JS questions and are always given solutions in jQuery :dozingoff:
Was This Post Helpful? 0
  • +
  • -

#14 blankwavercade  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 115
  • Joined: 13-December 11

Re: JQuery- Do developers need it?

Posted 30 January 2014 - 08:33 PM

I think the main reason people give jquery responses is because normally the person is coming looking for a quick fix. They normally don't care to understand why/how it works.

This post has been edited by blankwavercade: 30 January 2014 - 08:46 PM

Was This Post Helpful? 0
  • +
  • -

#15 ge∅  Icon User is online

  • D.I.C Regular

Reputation: 27
  • View blog
  • Posts: 253
  • Joined: 21-November 13

Re: JQuery- Do developers need it?

Posted 31 January 2014 - 02:34 AM

Hello guys,

What I dislike the most in jQuery/vanilla JS comparison is that they are really unfair. The best example is laytonsdad's AJAX snippet : the code is deliberately poorly written to make it look worse than it really is.

1- the native XMLHttpRequest object is supported by IE7 (2008, windows XP) and above, so the maqueRequest function is absolutely useless today. It's only here to make the snippet longer.
2- the request's readyState and status shouldn't be checked in the alertContents function (which is supposed to do nothing more than formatting the output). It's just making it less readable.
3- why do you use a closure and short-live functions (insinuating that you have to write all this blabla every time you want to do a HTTP request) when you could build a post() function just as useful as the jQuery one ?
4- why do you use (named) functions in you closure if the code is intended to be executed only once ?
5- and last but not least : why do you compare the whole vanilla JS process with a simple function call ? Where is the $.post function's body ?

Writing vanilla JS doesn't mean you don't have the right to use functions or objects. I have written my HttpRequest functions long ago and it's as simple as `POST("page", data, callback);` Exactly like the jQuery $.post function. My "library" is just 10 times smaller than jQuery and 10 times faster.

-

In my opinion, jQuery is OK when you don't know Javascript (especially its implementation in web browsers) very well, when you don't give a shit about performance and/or private life, or when you really like OOP and the way jQuery is written. I personally hate it : I always feel the need to access a native object or a native method because jQuery is very unnatural to me, I can sense its heaviness. I feel bad every time I press a key on my keyboard while writing jQuery. And I'm not exaggerating.

I also don't like services like Google Hosted Libraries because it's nothing less than a tracker. So if I am to use jQuery, it has to be hosted by my server, which makes the library a bit less interesting.

-

So if jQuery is useful, it is certainly not necessary, and sometimes it can even make things worse (try to write a video game in jQuery)
Was This Post Helpful? 1
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3