|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
TOP THREE LINKS YOU MUST CLICK ON Real-World AJAX Book Preview The Web Page as an Application
AJAX is the right technology for a Web-enabled rich user interface
By: Anil Sharma
May. 16, 2007 07:15 PM
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.
The Web Page as an Application Unfortunately in the past building a structurally sound UI for a complex business application was hard. Developers stumbled on a UI project only to find out that building a structurally sound UI, where a designer's work can be thrown at will, is tough. It soon became a time-consuming and labor-intensive undertaking. To make matters worse, prototyping one or two scenarios often gave a false estimate of the complexity. The real complexity came when a number of scenarios interacted with each other and the UI started to fall apart from a lack of structure. Building a rich UI was notably harder than a static or semi-dynamic Web UI. The aim of this chapter is to demonstrate how AJAX has solved some of the fundamental issues with building rich user interfaces and simplified it. We will demonstrate that it is relatively easier to build a structurally sound and cohesive UI using AJAX as opposed to other rich client technologies such as Swing and WinForms. An AJAX-based UI is well suited for iterative refinement and provides a clean interface for incorporating UI designers and artists' works. The original title of this chapter was "The Web Page as Application, Maintain Structure and Cohesion of Complex AJAX Pages." Since the business problems people solve using computers are inherently complex, the solutions tend to be complex in spite of the project team's best attempts to keep them simple. Often software system design and implementation becomes incomprehensible. Focusing our attention back on the user interface aspects of a software system, a sound structure is the key to a comprehensible and flexible UI implementation. If we can identify a set of repeatable patterns in user interface software, then it is possible to build relatively simple software even for complex business problems. If so our chapter heading can be "The Web Page as Application: Maintaining Structure and Cohesion of AJAX Pages for Solving Complex Business Problems." The business problem may be complex but the structure of the software doesn't have to be. So here we'll try to describe a structure for AJAX UIs that solves inherently complex business problems but isn't in itself complex. Having played with AJAX for about a year and having spent many years building UIs using Swing, WinForms, JSF and JSP technologies, there seems to be a light at the end of the tunnel. HTML DOM, CSS, scripting through JavaScript and an XML pipe to the data and services are enough for a flexible, easy-to-use and structurally sound UI framework. To summarize:
The initial sections of this chapter will discuss concepts abstractly. Later sections go into detail about the concepts through examples. The complete code for the examples given here can be downloaded from www.vertexlogic.com. It is available under the MIT open source license.
Assumptions and Guidelines
For completeness, the basic workings of an AJAX UI can be described as follows:
Figure 5.1 shows the architecture of a system that will be used in our discussion. It is generic and something we say will apply to any variation. Even if the architecture is changed, the principles discussed should hold. In the next few sections we'll provide an overview of the components shown in the diagram. These components will be discussed at greater length with example code and illustrations in subsequent sections. So the architecture can be viewed in two parts:
The client-side consists of the HTML pages and JavaScript code embedded in the HTML pages or included from separate files. HTML templates and JavaScript files are physically deployed with the server, but they are really a part of the client side. HTML pages and JavaScript code morph into Model, View, and Controller components in the browser space by design intent. XML over HTTP/HTTPS is used for interfacing between the client and server. It's possible to use Web Services for client/server interaction. But for purposes of the current discussion, we've limited the interface to XML over HTTP/HTTPS. In the example code, we've modularized the client-side implementation of this interface. It can easily be changed to work with Web Services instead of the controller servlet.
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. LATEST AJAXWORLD RIA STORIES
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||