JQuery: Novice to Ninja

***** Oct242010

Published in February of 2010 and up to date with JQuery 1.4, JQuery: Novice to Ninja is the 5th book on JQuery I’ve reviewed on this site. I bought it on a whim, when Sitepoint was offering the PDF version for only $5, and I’m glad I did. For some reason (perhaps it’s the rapidity with which they seem to churn them out) I have been skeptical of the quality of Sitepoint’s publications. However, in this case my concerns were unfounded: Novice to Ninja can help take your JQuery skills to the next level.

Project-based approach

Quite the opposite from Cody Lindley’s good but geeky JQuery Enlightement, this book is completely project-based. It uses a sample web-development project throughout to introduce and demonstrate new JQuery concepts. Starting with relatively simple tasks, like basic animation and enhanced menus and tooltips, and proceeding through to advanced plugin development and even extending JQuery itself, each new concept is presented in the context of this fictional website, and working code examples are available to download from Sitepoint.

Good programming practices

In the course of teaching JQuery functionality, this book presents several techniques for planning your code and writing organized, reusable code. In the past I have made the mistake of writing javascript piecemeal, adding bits of functionality as I go along. That can quickly get confusing and difficult to maintain. A better approach, and the one taught in this book, is to “stub out” — in effect, outline — your code, and then fill in the necessary details. An example on page 170:

$('.location').hover(function(e) { // Hover over code
    }, function() { // Hover out code
    }).mousemove(function(e) { // Mouse move code
});

The authors explain:

Starting with the overall structure and then filling in the details is a great way to plan out your code, ensuring you know what’s going on before diving in.

Other useful takeaways are:

  • Namespace your code to keep related functionality bundled together, and avoid confilcts
  • Use plugins, but sparingly, making sure they’re not overkill for what you need.
  • For functionality you may reuse, make your own plugin
  • Ways to use the data utility (new to JQuery 1.4)

A clear and pleasant tone

This book is addressed to front-end developers who have some experience with javascript but may be new to JQuery, and it speaks with a friendly but never condescending tone. The authors manage to explain small but important details, such as the difference between return: false; and preventDefault (p. 140) without feeling tedious, and advanced techniques such as “client-side templating” (p. 188) are described clearly and with illuminating examples.

Drawbacks

This book falls short in incorporating accessibility and usability. While accessibility is mentioned a couple of times, it’s not really baked in to each example. Also, usability concerns associated with Ajax and other Javascript functionality aren’t addressed. However, the fact is that this book is already covering a lot of ground. There are plenty of other resources covering these topics.

Conclusion

This book is definitely recommended for front-end developers wanting to enhance user interfaces, add Ajax functionality to websites and web applications, and learn how to write reliable, reusable JQuery code.

Given the quality of Novice to Ninja, I may have to reconsider some other Sitepoint titles.

Respond to this review

Author(s)Earle Castledine, Craig Sharkie
PublisherSitepoint
Pages407
Published2010
ISBN-100980576857
Category
Tags
Rating*****

No comments yet…Be the first!

Comments are closed for this article.