Book Review – Ajax in Action

Book Review – Ajax in Action

Author:Dave Crane
Eric Pascarello
Darren James
ISBN: 1932394613
Publisher: Manning Publications
650 pages
Published: Oct 2005

If you are looking for some Ajax code to copy and paste into your webpages, this is not the book for you. But if you are creating Ajax web applications on a large or small scale and need to consider such aspects as design and refactoring, security, speed and system resources, then this book will help answer some of these questions. Although the authors, Dave Crane, Eric Pascarello and Darren James, discuss mostly the client-side of Ajax, their approach for this book is to re-teach web programmers away from the standard/classical webpage and introduce a new way for the server, browser and webpage to work together through Ajax.

The first part of the book concentrates on what Ajax is and how it differs from standard/classical web programming. The authors discuss the four core technologies of Ajax (JavaScript, CSS, DOM and XMLHttpRequest) concentrating on the different ways each is used and how they work together in an Ajax application. Ajax takes the concept of separation of tasks to an advanced level.

Once you are familiar with this new approach to these four preexisting technologies, you are ready to work on refining the coding process. Ajax uses a larger amount of JavaScript compared to classical webpages and the webpages are refreshed less often. The author's approach to managing a large Ajax code base is by design framework and refactoring which is a fancy way of saying they teach you to write small, reusable chunks of code where each chunk has a specific task. They take this code component framework further by using the Model-View-Controller architecture which separates an Ajax application into three parts. The Model is the part that performs the task and the View is the part that presents the results. The Controller is the liaison between the other two. By keeping these parts separate, your code is more reusable and more easily maintained. Changes to one part do not directly affect the other part.

With Ajax, the user does not have that familiar "click and wait" routine as the webpage refreshes to reflect changes. With Ajax, as the information is passed to the server and data is returned to the browser, there is no need to refresh the webpage. Therefore we need new ways to keep the user informed as to the process. A few of the new visual feedback components discussed here are the status bar, pop up dialog and inline highlighting. All of these happen asynchronously.

Many books do not address the topic of security. One thing I liked about this book was that the authors discuss potential security issues when using Ajax and several possible ways to close these security holes. Another area covered was performance issues such as speed and system resources. First you learn ways to monitor the performance of your Ajax application and then how to analyze and improve your code.

The book finishes with five sample projects which are built step-by-step. The first is an Ajax web form. In this project you learn how to use Ajax to link form input fields in such a way as to pre-populate the values (choices) in the form fields. The choice made by the user in one form field causes the values for the second field to be updated as necessary. This can be done without reloading the webpage because the two fields are linked and Ajax does the updating in the background. Next you learn how to create an Ajax type-ahead suggest feature (such as the Google SuggestTM) and ways to possibly improve on this using an object-oriented TextSuggest component. Moving from forms to more advanced user interface features, you will learn how to create an Ajax portal project such as, an Ajax based live search system and how Ajax can work with external RSS protocol instead of a server.

The authors first walk you through coding these projects and then show you how to refactor each into reusable components. When you have finished, you should have a code library that you can apply to any Ajax web application.

Dave Crane is a computer programmer and simulation modeller. Eric Pascarello is an ASP.NET developer and the author of JavaScript: Your Visual Blueprint for Building Dynamic Web Pages (2nd ed.). Darren James is the architect of the open source Rico project.

This site needs an editor - click to learn more!

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.