This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes jQuery Fundamentals Live Lessons - taking up jQuery? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery Fundamentals Live Lessons - taking up jQuery?" Watch "jQuery Fundamentals Live Lessons - taking up jQuery?" New topic
Author

jQuery Fundamentals Live Lessons - taking up jQuery?

J Yishmeray
Greenhorn

Joined: Mar 23, 2013
Posts: 8
    
    2
I am familiar with JavaScript, but have hesitated with JQuery or other libraries of that kind. Partly, I suppose, this is because I have been doing stuff in this realm from back when a 50k web page was large, and I've been shy about size. Yes, I know people have higher bandwidths to work with now, and web pages have become commensurately larger. Fair enough. And partly because I have not yet found anything I felt was too hard via JavaScript. I am willing to be convinced though, and the format of your videos seems reasonably accessible. I've watched a bit of your samples, and read Jeanne Boyarsky's review.

How about it? Could you give me a few thoughts on why I should be taking up jQuery, pros and cons perhaps?

-- Yish
Phil Dutson
author
Greenhorn

Joined: Mar 31, 2013
Posts: 9
    
    5
Hi Yish,

Apologies for the late reply, but to answer you question in the method you suggested:

Pros for jQuery:
- Cross-browser compatibility (Standardization for events and Ajax)
- Initially small learning curve
- I mentioned Ajax already, but jQuery makes Ajax super easy
- Easy and fast to learn, if you can read CSS, you can start using jQuery
- When combined with gzip/deflate on your web server, including jQuery is like including a small image on your site (less than 20k)
- jQuery has several project families that build on one another to give you everything from widgets, drag-and-drop, to mobile development (jQuery UI and jQuery Mobile)
- Plugins
- Chaining

To explain the list above, jQuery combines ease of use with speed. By being able to chain methods together you can write easy-to-read code that fits on either one or a few lines that would otherwise take up a paragraph. By dealing with browser specific behavior you are free to focus on what you want your code to do rather than adding separate code blocks for different browser types. This is especially useful when creating and using Ajax. No longer do you need include one block for IE and one block for everyone else.

The selector engine in jQuery is really rather amazing; you can get any object you want in the DOM quickly and manipulate it with extreme ease.

Depending on your use case and your server technology, jQuery may be a bit large to include on some projects, however compared to other libraries it comes in at rather a 1/4 of the size (yes, there are other libs like zepto that have the similar selector engines and are considerably smaller than jQuery, but they lack all of the features of jQuery).

Including the other jQuery projects, such as jQuery UI, help when dealing with creating buttons, lists, calendar/date select objects, progress bars, draggables, and more. jQuery Mobile can be used to help standardize the way your site or web application functions on a variety of devices and offers fallback solutions for devices that would otherwise be unable to view your site. jQuery Mobile also handles swipe events, touch vs click events (and the 300ms delay), and gives you a variety of effects, widgets, and events to use. No matter what your application entails, the odds are that someone has done it before or run into the same problem. And that means that they have probably found or written a plugin for it. jQuery has a very large list of plugins that can be used to help you do a little bit of everything.

Cons for jQuery:
- Can be a developer "crutch"
- May "bloat" page size when included in projects that really do not need it
- You may become highly opinionated and rather biased towards other JavaScript libraries

I have met several developers that do not actually understand JavaScript at all, but use jQuery to do literally everything. This isn't a huge problem for them in their environment, but it does cause headaches when trying to not use jQuery, or when learning other JavaScript libs or even when working with Node.js. Once I even saw a developer include jQuery just so he could use the selector in it to grab an element by ID (the definition of overkill). After using jQuery, some other libraries may seem slow or "bloaty". I currently have a project where the team has never used dojo before and is continually knocking it for the file size (over 500kb before gzip), and the difference in project set up.

Hope the list helps

[My LiveLessons]
J Yishmeray
Greenhorn

Joined: Mar 23, 2013
Posts: 8
    
    2
Phil - thank you very much. As I had hoped, that list (well, both lists) has some surprises in it. This helps a great deal.
- Yish
 
GeeCON Prague 2014
 
subject: jQuery Fundamentals Live Lessons - taking up jQuery?