| By Coach Wei, Rob Gonda | Article Rating: |
|
| February 17, 2007 10:00 AM EST | Reads: |
16,204 |
This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs for the special pre-order price, click here for more information. Aimed at everyone from enterprise developers to self-taught scripters, Real-World AJAX: Secrets of the Masters is the perfect book for anyone who wants to start developing AJAX applications.
AJAX Application Architecture
Given the challenges associated with AJAX, it is particularly important to architect an AJAX application properly. Otherwise the result can be either lackluster performance or a code maintenance nightmare, or both.
Two items significantly impact AJAX application architecture: the choice of an AJAX engine and client-side application logic implementation.
The AJAX Engine
From the point-of-view of software architecture, the big difference between an AJAX application and a classic HTML Web application is the introduction of a client-side engine. This engine, which runs inside the Web browser, acts as an intermediary between the application's UI and the server. User activity leads to calls to the client-side engine instead of a page request to the server. And data transfer takes place between the server and the client-side engine rather than involving the Web browser directly.
The AJAX engine is key to the AJAX application model. Without it, every event generated by user activity has to go back to the server for processing. Figure 1.7 illustrates this, while Figure 1.8 illustrates the more efficient AJAX model.
There are many different ways to implement the client-side AJAX engine. One approach is to write it from scratch based on the application's needs. Another approach is to use an AJAX toolkit. There are many AJAX toolkits today, a lot of them open source. Some are communication libraries, some are rich user interface components and some provide both. Choosing the right toolkit significantly lowers the application development and maintenance challenge.
Application Logic Partition
Regardless of the client-side AJAX engine implemented, how one partitions the application logic directly impacts application performance and maintainability. "Application logic partition" refers to the amount of application logic that runs on the client side versus the amount of logic that runs on the server side. Putting more logic on the client side delivers better application performance. However, client-side logic can easily result in a lot of hard-to-maintain JavaScript code. For example, Google Maps is a relatively simple application with limited functionality, but it still has more than a 100KB of JavaScript logic on the client side (after obfuscation and compression). But putting more logic on the client side can potentially create application maintenance problems that are expensive and hard-to-scale.
What kind of logic should be put on the client side? How much logic and how should the logic be implemented? These are key questions that developers have to weigh carefully in order to build manageable and maintainable applications.
The AJAX development model offers a lot of flexibility in application logic partition as shown in Figure 1.9. On the left side of the figure, most of the application logic as well as data are on the client side. This is a client-centric model that closely resembles your typical desktop application model. On the right side of the figure, all the application logic resides on the server side. This is a server-centric model that is very similar to the classic HTML Web application model except for the "RIA" (Rich Internet Application) AJAX engine on the client side. Obviously, developers can partition their applications anywhere between these two extremes.
What is worth pointing out here is that the server-centric model is fully capable of delivering a rich user experience such as a rich UI and asynchronous partial updates because of the RIA AJAX engine. In this model, the number of round-trips is not necessarily reduced compared to the classic HTML application model, but the amount of data to be transferred is much smaller. The asynchronous nature of the AJAX engine enables a "continuous" user experience. The popular JavaServer Faces (JSF) model is a server-centric model that encourages all the processing to happen on the server side. The benefits of this model include a more enhanced user experience than the classic HTML application, compliments of the client-side AJAX engine as well as good application maintainability. Because all logic stays on the server side, it's much easier to develop and maintain application code on the server side than deal with JavaScript code on the client side.
By comparison, a server-centric model will not deliver the same performance and availability as a client-centric model. In client-centric models, a significant amount of application logic runs on the client side. As a result, most user interactions can be processed locally without incurring a roundtrip to the server. Further, the application can be more "resistant" to sporadic network connectivity drop-off. Application availability is improved because of this reduced network dependency. The drawback to such a client-centric model is the challenge associated with developing, sharing, and maintaining the client-side JavaScript code.
Some AJAX toolkits provide frameworks that facilitate the appropriate partitioning of application logic between the client side and the server side. For example, JSF is a framework that encourages putting all the logic on the server side.
This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs, click here to order.
Published February 17, 2007 Reads 16,204
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Coach Wei
Coach Wei is the Founder and Chairman of Nexaweb (www.nexaweb.com), developers of the leading software platform for building and deploying Web 2.0 and AJAX applications. Previously, he played a key role at EMC Corporation in the development of a new generation of storage network management software. Wei has his master's degree from MIT, holds several patents, is the author of several technology publications including JDJ, Web 2.0 Journal, and AJAXWorld Magazine, and is an industry advocate for the proliferation of open standards.
More Stories By Rob Gonda
Rob Gonda is an industry visionary and thought leader, speaks on emerging technologies conferences nationwide, and combines unique approaches to technology and marketing strategies. He is the former Editor-in-Chief of the AJAX Developer’s Journal, an Advanced Certified Coldfusion Developer, member of the Adobe Community Experts, frequent contributor to the CFDJ and ADJ, co-author of Real-World AJAX: Secrets of the Masters, author of AjaxCFC, holds a BS in computer science and engineering and an MBA with a specialization in entrepreneurship. Rob recently joined Sapient from ichameleon/group/ where he was a founding partner and chief technical officer. He is part of the global technology leadership team, and brings with him over ten years of experience in web development and 360 marketing campaigns for clients such as Adobe, Coca-Cola, Guinness, Toyota, Taco Bell, NBC, and others. He specializes in emerging technologies, marketing strategy, social media, and he is currently fascinated with rich internet applications, service oriented architecture, mobile, agile methodology, automation, behavioral targeting, multi-channel synergy, and identifying new trends. Rob’s mission is to develop forward-thinking expertise that will ensure clients are always on par with rapidly changing technologies and maintain its ethos of evolving. You can reach him at rob[at]robgonda[dot]com and read his blog is at http://www.robgonda.com
- 4th International Cloud Computing Conference & Expo Starts Today
- Publishing Synergy: Blog, Twitter and Ulitzer
- Performance Tuning Essentials for Java
- Cloud Expo New York Call for Papers Deadline December 15
- Google Wave
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Cloud Computing Can Revitalize Your Career as Software Developer
- SOA World Magazine "Readers' Choice Awards" Voting Is Now Open
- Oracle+MySQL Opponents Take to the Barricades
- Virtualization Expo Call for Papers Deadline December 15
- Oracle Faces Growing Price for MySQL
- SpringSource Moving to Spring 3.0
- 4th International Cloud Computing Conference & Expo Starts Today
- Deputy CIO of the CIA to Keynote 1st Annual GovIT Expo
- Publishing Synergy: Blog, Twitter and Ulitzer
- Performance Tuning Essentials for Java
- Cloud Expo New York Call for Papers Deadline December 15
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Google Wave
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Cloud Computing Can Revitalize Your Career as Software Developer
- Oracle-Sun: IBM Reportedly Behind Delay
- Citrix Aims To Cripple VMware’s Cloud Designs
- Oracle Trashes HP Relationship for Sun
- After Ubuntu, Windows Looks Increasingly Bad, Increasingly Archaic, Increasingly Unfriendly
- SCO CEO Posts Open Letter to the Open Source Community
- Simula Labs Launches Hosted Delivery Platform To Enable Enterprise Open Source Adoption
- Where Are RIA Technologies Headed in 2008?
- Source Claims SCO Will Sue Google
- How Open Is "Open"? – Industry Luminaries Join the Debate
- Latest SCO News is Plain Weird
- IBM Tells SCO Court It Can't Find AIX-on-Power Code
- SCO Claims Linux Lifted ELF
- Flashback: Investing in 'Professional Open Source' - Exclusive 2004 Interview with David Skok, Matrix Partners
- HP Starts Pushing Desktop Linux
- Linux Business Week Exclusive: Linux Kernel To Be Re-Written To Counter Microsoft FUD


























