« Foreign language ads. through Google Adsense | Main | The most amazing thing about kiko auction »

Book Review: Ajax Design Patterns

A number of AJAX libraries and frameworks have emerged to purportedly simplify development of Rich Internet Apps, though none can substitute, at least not yet, a good understanding of what are the recurring problems, potential solutions and what goes on behind the sleek facade of a browser to power these hot and sexy Apps. This is best said by Michael Mahemoff, author of Ajax Design Patterns, in his blog post of May 8, 2005, which eventually became the basis for a popular Wiki on Ajax Patterns and later, this book.

Careful design is always required, and it must be based specifically on the technology at hand. As AJAX emerges, we’re going to learn more about what sort of design works, and we’ll need ways of documenting this information and talking about it. Fortunately, the evolution of this particular technology will take place at a time when design patterns are well-entrenched in the industry, and design patterns are an excellent means of knowledge representation.

True to its promise, the Ajax Design Patterns book, with its more than 70 design patterns, documented in more than 600 pages with encyclopedic detail, is very effective in presenting the AJAX programming knowledge in a reader friendly format. In the spirit of seminal GoF Design Patterns work, it captures the essence of each of the topics with problem solving approach -- first stating the problem in general terms and then presenting the solution, outlining the approach and discussing variations, alternatives, trade-offs and even listing actual uses in real applications. Btw, if you noticed I used the term topics (with emphasis) in the previous sentence to refer to its 70+ "knowledge modules" and not patterns, mostly because I wouldn't categorize all of them as patterns. However, this disagreement on terminology doesn't take away anything from their practical usefulness and in fact, for sake of consistency, I would continue calling them "design patterns".

A bit on scope and level of material presented in the book -- most of the material is quite advanced and assumes good knowledge of technologies for writing web based applications: HTTP, JavaScript, (X)HTML, CSS, PHP and a bit of W3C DOM. The code fragments, and there are quite a few of those, are in JavaScript (for client side) and PHP (for server side). Most of the prominent AJAX libraries, toolkits and frameworks are also mentioned, often while discussing a particular pattern as a reference of actual use. The appendix lists them all at one place and highlights their main features. Though, the book carefully avoids to recommend any one as the AJAX toolkit.

The book categorises the design patterns as Foundational Technology Patterns (those related to repainting the user interface, browser and web server communication, and event handling), Programming Patterns (those related to programming aspects of either end, browser or the service, of the application), Functionality and Usability Patterns (those related to functional widgets such as slider, data grid, progress indicator etc., page layout, visual effects and so on) and Development Patterns (those related to debugging and testing). Of course, the real value is in the details of each pattern, and not just the high level categorization or overview.

A reader of this review may be interested in knowing why should he or she buy the book when most of the content is freely available at the Ajax Patterns Wiki. Here is my take on this: although most of the content is available on the Wiki, the text in the book has gone through professional editing and is more readable. Also, the description of most of the patterns run into multiple pages, and it becomes hard to read long articles while connected to the Internet (I tend to click on links and wander away). As an additional bonus, the book includes illustrative diagrams, which I found quite helpful, and at times, funny.

Although most of the patterns included in the book taught me something new, I do have a list of favourites:

  • XMLHttpRequest Call: One of the most comprehensive treatment of XMLHttpRequest object and its various use patterns, limitations and alternatives.
  • On-Demand JavaScript: How to do lazy loading of JavaScript code to improve responsiveness or get data from a different server.
  • HTTP Streaming: How can a server keep sending data to the browser over an HTTP connection initially established by the browser.
  • Call Tracking, Submission Throttling: How to protect your server from excessive load by very active users without compromising responsiveness.
  • Browser-Side Cache: Ajax doesn't solve the inherent latency problem of the Internet. You still need the good old tricks to improve the user experience.
  • Malleable Content: How to let the user edit some information on a mostly read-only page.
  • One-Second Spotlight, One-Second Mutation: How to communicate change in a portion of the page without being obtrusive.
  • Direct Login: How can you improve the user experience as well as the security of authenticating user using Ajax and JavaScript wizardry.
  • Unique URLs: Going Ajax should not require your users to abandon joys of hyperlinking and the old and tried habits of navigating content by clicking on the familiar back and forward buttons.

So far I have only been talking about things that I liked. But what are the weak spots? There are not many: I did notice a few minor typographical issues with certain code fragments, but they are rarely serious. For example the first code fragment on page 96 has uses variable requestTimer to store the return value of setTimeout() and then uses variable requestTimeout as argument to clearTimeout(). This is so minor that I didn't even feel like bringing it up, but then as a reviewer I must point out something that can be improved.

A good addition for a future edition could be patterns on AJAX program performance during development, deployment and runtime such as JavaScript compression to improve download times and execution speed and considerations on using multiple third party JavaScript libraries.

Another thing I found a bit annoying at times is presence of a lot of URLs all over the text with hints too brief to allow uninterrupted reading away from the computer. I would have preferred numbered footnotes, either in each page or at the end of each pattern, with URLs and a brief summary of its contents. Usually I read printed books when away from the computer and do not wish to go to the computer and type-in the URLs to just understand what is being said in the text. Although immensely helpful during online viewing, the embedded URLs are a hinderance during offline reading. This is one area where the structure of printed content should be different from the online content.

Overall, I would recommend the Ajax Design Patterns to all those who work or aspire to work on web development projects as an excellent reading and reference resource.

About

This page contains a single entry from the blog posted on August 17, 2006 5:04 PM.

The previous post in this blog was Foreign language ads. through Google Adsense.

The next post in this blog is The most amazing thing about kiko auction.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33