Dan Schaefer

Content Writer, Programmer, Marketing Consultant

April 28th, 2014

Book Review: jQuery 2.0 Development Cookbook

Book Review, jQuery, Programming, by Dan Schaefer.

It’s been a while since my last post. As crazy as it may seem, I’ve been super busy lately. Ever since I was “downsized” from my full-time job last November, I’ve found boatloads of work to be done as a freelance programmer and writer. I’ve also managed to get deeply involved in two start-ups, both of which require my full-time attention to programming. The pay is not nearly as good as before – in fact, it’s next to nothing – but I’m having a truckload of fun. Makes me feel like I just graduated from college all over again.

Anyway, over the last couple months, I’ve managed to squeeze in enough time to read yet another technical book. In exchange for writing a review on this new book, the folks at Packt Publishing provided me a free copy! The book is called jQuery 2.0 Development Cookbook, written by Leon Revill. Unfortunately, I didn’t find it to be highly useful. For the record, Packt is one of my favorite publishers, as they provide a steady stream of technical books that satisfy my never-ending need for fresh technical content. And I like their policy of providing DRM-free PDF files, which works very nicely with my iPad. So I was disappointed to see a book that – in my opinion – failed to meet their normal standards.

My complete review appears below, but the bottom line is that I give this book 3 of 5 stars. You can still learn a little by reading it, but it simply fails to provide enough good material for experienced programmers, and at the same time, it’s just too advanced for beginners.


jquery2.0devcookbookjQuery 2.0 Development Cookbook by Leon Revill introduces the reader to jQuery through 80+ recipes that start with basic DOM manipulation and gradually works into more advanced topics like jQueryUI and the development of mobile applications.

While the book does present some interesting concepts and can be used as a limited reference, I give it only three of five stars.

There are some fundamental problems with this book, starting with its attempt to serve two masters: the newbie and the experienced programmer. Personally, I’ve never seen a book successfully pull this off. In this particular book, newbies will get lost in long passages of code, and experienced programmers will grow impatient with the same long passages of code.

These long passages of code obscure the often simple – and useful – concepts hidden deep within. In one recipe, for example, the author attempts to show how you can build a search feature. Unfortunately, it takes 7+ pages of code, where you not only go through jQuery, but you dive deep into CSS, PHP and MySQL.  If newbies aren’t already familiar with these other languages, they’re going to put the book down. To add insult to injury, the actual search itself is not even implemented in jQuery; rather, it all comes down to a relatively simple MySQL query. The bottom line is that the long passages of code – most of which are completely unrelated to jQuery – sabotages any attempt to gain a deeper understanding of jQuery. The book could more aptly be called a website solution cookbook.

Speaking of the book title, nowhere in this book is it made clear why the title mentions version 2.0 of jQuery. Not until you get to page 58 is version 2.0 mentioned, and even then, it’s mentioned as a small side-discussion.

Regarding code integrity, I found many places in the book’s code that, while not technically incorrect, demonstrates poor coding structure. For example:

  1. Global variables are introduced but only used within a single function.
  2. JavaScript functions are created but only called from one other function.
  3. Multiple JavaScript functions make changes to variables within a common scope, running roughshod over the concept of isolation and ecapsulation.
  4. HTML <label> tags are heavily used but not tied to any specific <input> tag. In other words, the <label> “for” attribute was either missing or the <label> tag was not embedded within an <input> structure.

Additionally, there are many places where the author added code that was completely unnecessary. For example consider this PHP code snippet on page 115:

for ($i = 1; $i <= 2; $i++) {
sleep(1);
}

Why not simply:

sleep(2)?

Similarly unnecessary JavaScript code appears on page 185:

var spamNumber = Math.floor(Math.random() * (100 – 1 + 1)) + 1;

Wouldn’t it be far easier – and less confusing – to code the following?

var spamNumber = Math.round(Math.random() * 100);

The final chapter on jQuery Mobile presents some interesting information, though many of the recipes don’t need jQuery to run. For example, the recipe entitled, “Implementing the quick call functionality” pulls in the jquery.min.js and jquery.mobile.min.js libraries; yet if you leave out these libraries, the code still runs! The only concept this recipe introduces is the fact that you can include the “tel:” directive within your <a> tags so that anyone clicking on the associated hyperlink will automatically make a phone call, assuming they’re using a mobile phone device. This is not necessarily new or interesting enough to devote a whole recipe to it. And ultimately, it has nothing to do with jQuery or jQuery 2.0.

While the recipes in this book are sometimes useful, I found that I had to dig through a lot of superfluous code to uncover the promised gems. This enormous amount of unnecessary code – much of which needs peer-review – causes the book to lose focus, and as a result, its readers are likely to lose focus as well. Were it written more concisely and with sharp focus only on jQuery, the number of recipes could have easily quadrupled within the same page count, perhaps offering more really useful stuff for newbies and experienced programmers.

Share Button

Back Top

Comments are closed.