Developer Product Briefs

Java's RIA Option for Robust Web Apps

Do you want the responsiveness of Ajax, but with more solid technologies? Consider Java Rich Internet Applications.

Java's RIA Option for Robust Web Apps
Rich Java applications offer an alternative that can have advantages over Ajax.

Ajax is great for many applications, but not for all applications. When applications get large, need to scale, or require superior security, Java-based Rich Internet Applications (RIA) might be preferable. There is a simple reason for the RIA alternative: Java offers by far the most advanced, most standardized, and most reliable cross-platform UI technology. Designed for full-fledged desktop applications, client-side Java outclasses Ajax in terms of functionality, stability, performance, and security.

There is only one issue with conventional Java clients; they don't fit into a Web architecture, despite applets and Java Web Start. A solution for this issue is Java RIA technology. This technology bridges the gap between Java's rich UI components and a server-side Web architecture, leveraging both the advantages of client-side Java and server-side application management. Industrial strength performance and scalability thus becomes feasible for enterprise applications as well as new-generation, Web 2.0 applications and sophisticated mash-ups.

Java RIA solutions implement the architecture shown on the left-hand side in Figure 1, where a compiled presentation engine runs on the client, either as an applet within a browser or as a desktop application. The presentation engine interprets abstract UI descriptions that are generated on the server, using the components of the Java Runtime Environment (JRE) to handle the UI. Most Java RIA products available today use this approach.

The split between client and server is realized within the presentation layer and built into the RIA product. Presentation logic is designed and executed on the server, together with the logic for business functions and persistence. The obvious advantage of this approach is that the presentation engine works like a browser and needs to be installed only once for any number of applications. Another benefit is that the server-side architecture fosters reliability, scalability, performance, and security. Keeping all of this processing on the server makes it much easier to achieve these qualities—for example, security. This architecture also simplifies development: the RIA library resolves the issue of distributing code between client and server, thus eliminating a major programming challenge that is a frequent cause for project failure.

The architecture of Ajax solutions varies over a broad spectrum ranging from thin client to rich client, as shown on the right-hand side in Figure 1. Ajax developers are at liberty to move any code to the client, including business logic and persistency services. This freedom of choice compromises architectural simplicity and often leads to poorly conceived software that is unreliable, difficult to maintain, insecure, and lacking in performance.

A Proxy for UI Components
Java libraries for desktop UIs are mature and offer a comprehensive set of components that satisfy the requirements of any business application. There are two industrial standards: the Abstract Windowing Toolkit (AWT)/Swing and the Standard Widget Toolkit (SWT)/JFace. Either option is an excellent basis for an RIA product. Both have reached a high level of quality and a substantial installed base. RIA products can therefore be reduced to a server-side proxy layer for an established Java UI library.

This approach leads to the thin-client architecture mentioned, where a presentation engine handles the UI but executes no application code. The amount of code needed for such a product is minimal; the J2EE/J2SE infrastructure provides everything except for a thin layer of software that implements the server-side proxies and the communication software that synchronizes these proxies with the client-side UI components (see Figure 2).

In contrast, Ajax products must provide the full software stack of the UI components, since JavaScript offers nothing beyond basic events and drawing functions. Current Ajax libraries are at the very beginning of their maturity curve. Moreover, they cannot rely on a stable execution environment but have to cope with incompatibilities between browsers and platforms. For this reason, it is unlikely that their components will ever reach the level of functionality and quality of AWT/Swing or SWT/JFace. Furthermore, there are numerous contenders in today's Ajax market. Nobody knows which of them will survive eventually.

One of the drawbacks of conventional Web applications is their heterogeneous technology. Any moderately complex application will be a mixture of HTML and Java, plus a number of add-on technologies like servlets, cascading style sheets (CSS), DHTML, XSLT, Struts, or JSF. Ajax adds a further paradigm and exacerbates this situation (see Figure 2). Developing a rich UI with this conglomerate of technologies resembles an attempt at building a racing car with spare parts from trucks, family vans, eco-cars, and two-stroke scooters. Tools fail in providing adequate support for development because they are unable to manage the dependencies between the technologies. Programming becomes an exercise in creating a patchwork that is hard to debug, test, and maintain.

By comparison, Java RIA technology is a true racing car. Built with a seamless Java design, components fit together and execute in a well-defined environment. Developers can write their programs within a single IDE that offers sophisticated support for debugging and the management of dependencies.

RIA solutions that are based entirely on Java reach beyond Ajax; they rely on UI libraries that are years ahead of JavaScript technology. Their server-side architecture is proven and easy to scale. Finally, Java RIAs profit from their homogeneous design that simplifies development, debugging, and testing.

About the Author

Marc Domenig is founder and CEO of Canoo Engineering, a provider of J2EE software products and services that specializes in Web front-end applications. Marc is also a consultant for international IT companies and banking corporations and senior vice president and head of Web engineering and systems engineering at UBS, the largest Swiss banking corporation.

comments powered by Disqus

Featured

Subscribe on YouTube