Machine Learning Authors: Liz McMillan, Yeshim Deniz, Pat Romanski, Elizabeth White, Corey Roth

Related Topics: Machine Learning

Machine Learning : Article

Real-World AJAX Book Preview: AJAX Application Architecture

Real-World AJAX Book Preview: AJAX Application Architecture

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.

More Stories By Coach Wei

Coach Wei is founder and CEO of Yottaa, a web performance optimization company. He is also founder and Chairman of Nexaweb, an enterprise application modernization software company. Coding, running, magic, robot, big data, speed...are among his favorite list of things (not necessarily in that order. His coding capability is really at PowerPoint level right now). Caffeine, doing something entrepreneurial and getting out of sleeping are three reasons that he gets up in the morning and gets really excited.

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. As a head of Creative Technologies at Sapient, Gonda is an interactive technical “guru,” who provides the knowledge and experience required to run high-level, multi-channel interactive campaigns that reach millions of consumers. Gonda has more than 15 years of experience in web development and 360 marketing campaigns for clients such as Coca-Cola, Adobe, Guinness, Toyota, Taco Bell, NBC, and others. His areas of specialty include emerging technologies, marketing strategy, social media, digital out-of-home, mobile, behavioral targeting, and multi-channel synergy. Before joining the strategy and technology leadership teams at Sapient, Gonda was co-founder and chief technical officer at iChameleon, a Hollywood FL-based agency renown for its emerging experiences and creative technology. In addition to his agency work, Gonda the chair for the digital media council at the Advertising Research Foundation, is the former editor-in-chief of the AJAX Developer’s Journal, co-author of “Real-World AJAX: Secrets of the Masters”, a passionate blogger who authors www.takemetoyourleader.com, and contributors to various publications such as Ad Age and Ad Week. He is a frequent figure on the speaker circuit, having presented at conferences from the senate’s CIO emerging technology to SXSW and Omma. 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://takemetoyourleader.com

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

CloudEXPO Stories
DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by FinTechEXPO. ICOHOLDER gives detailed information and help the community to invest in the trusty projects. Miami Blockchain Event by FinTechEXPO has opened its Call for Papers. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Miami Blockchain Event by FinTechEXPOalso offers sponsorship and exhibit opportunities.
Today, we have more data to manage than ever. We also have better algorithms that help us access our data faster. Cloud is the driving force behind many of the data warehouse advancements we have enjoyed in recent years. But what are the best practices for storing data in the cloud for machine learning and data science applications?
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science" is responsible for guiding the technology strategy within Hitachi Vantara for IoT and Analytics. Bill brings a balanced business-technology approach that focuses on business outcomes to drive data, analytics and technology decisions that underpin an organization's digital transformation strategy.
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term.