Archive for July, 2011

JavaScript Task Queue – Hack it #9

Sunday, July 17th, 2011

Suppose you have a lot of tasks with completion callbacks to complete in the browser, but you want to do them sequentially. For instance, you might have a list of AJAX requests to make to your server.

This JavaScript demonstrates a simple solution:

If you can’t see the source code, look here.

Book Review – Programming HTML5 Applications by Zachary Kessin (O’Reilly Media)

Saturday, July 16th, 2011

“Programming HTML5 Applications” is a new book from O’Reilly media that focusses on some of the new technologies available in HTML5. It also places significant emphasis on the language of web applications – JavaScript.

The book starts with a brief history of the Internet and the web, before covering some of the trickier features of JavaScript in Chapter 2 – primarily closures, the event-oriented nature of JavaScript, and the DOM.

Next is a good overview of two JavaScript frameworks: the ultra-popular JQuery and the more application oriented ExtJS, before moving on to some testing frameworks – QUnit for JavaScript unit testing, and Selenium for browser interface testing.

The author then moves on to HTML5, briefly covering:

  • local storage,
  • application caching,
  • web workers and
  • web sockets.

Finally, some interesting server side technologies are described: the “cloud” paradigm, node.js and Erlang. The book concludes with some useful JavaScript tools.

The copy provided for this review was an “early access” version which hasn’t been through the full editing process. The book clearly still requires considerable polish – I was surprised to find that the HTML5 chapters cover less than half the book; they feel incomplete. The “web workers” chapter contains a detailed example, but the other HTML5 chapters do not.

When learning a new technology, I like expert, clear advice about best-practise, and the production-readiness of each technology. This was lacking in the chapters on HTML5. For instance, there is little mention of which browser versions support which technology – an important consideration when deciding whether or not to use a particular feature.

Currently much better HTML5 resources are the truly excellent Dive into HTML5 and HTML5 Rocks.

In contrast, the JavaScript chapters are well-written and informative, particularly the framework and testing chapters. I would have liked to have seen some analysis of the other major frameworks. The overview of QUnit and Selenium and their use-cases made for a useful introduction to these tools.

When the final copy comes out, hopefully the HTML5 chapters will have filled out, and the many little errors corrected. Assuming this happens, this book will serve as an introduction to the main technologies involved in building an HTML5 application.

Note: This review applies to an “early access” version of the book and was provided by O’Reilly Media as part of their blogger review program.

I review for the O'Reilly Blogger Review Program