Java RIA an effective alternative to AJAX?

As Asynchronous JavaScript and XML (AJAX) take center stage in the race to develop user interfaces for rich Internet applications, some companies have had good results with pure Java.

In March 2005, Farm Credit Canada (FCC) started to put together a Web front end prototype using Java Server Faces technology for a loan renewal application that would run in a portal. Development was cumbersome and taking a long time. "We were just finding all sorts of idiosyncrasies with JSF; I mean it is still relatively new technology," says Greg Hutchinson, FCC's principal developer.

From an end user standpoint, there were difficulties with the portal. "If they started entering some data in one portlet, hit a button in another portlet, they would lose the data from the other portlet," he recalls.

In July, while the JSF project was still underway, Hutchinson noticed that Canoo Engineering AG, a Swiss company that offers a server-side API to Java Swing components (text boxes, buttons, other widgets), inked a major agreement with the Union Bank of Switzerland. With Canoo's technology UltraLightClient, each client-side Swing component has a corresponding component on the server, so developers use a server-side programming model. The architecture features an application-independent Java 2, Standard Edition presentation engine, which displays the user interface on the client and forwards the user interactions to the server. Like an HTML browser, any number of ULC-based applications can use the same ULC presentation engine. The ULC presentation logic, business logic, business objects and persistence all reside on the Java 2 Enterprise Edition server.

Already familiar with Canoo's technology, Hutchinson brought consultants from the company to FCC, did a proof of concept and then switched technologies in October. "We re-did the whole user interface using their technology in the five months that were remaining on the project," says Hutchinson.

With ULC’s server-based solution, all the application code was running on the server side. Programmers didn't have to worry about what was running on the client, and things like browser interdependencies, because they were handled by Canoo's generic framework.

Hutchinson and his team also found several benefits to adopting the Java-only solution. "In terms of refactoring and JUnit testing, we could use all of the same technologies that everybody was familiar with in the Eclipse environment," says Hutchinson. Because FCC practices eXtreme programming as part of its development methodology, and aggressively refactors the code, pure Java eliminated several headaches.  "With scripting languages, and JSF, they are always missed by the refactoring tools," he explains, "so we would change a name to a class name and somebody would forget to change the JSF, because the tools don't see it—it is just a piece of text to the Eclipse environment or the other tools that we are using—and we didn't find out about that until runtime. So with JSF, it was real slow, and in Java, we would rename a class and it was done instantly and the developer keeps going."

Since March, the loan renewal application has been rolled out to 800 employees. "We haven't had any complaints," says Hutchinson. In his view, the server-side programming model and standard Java unit testing allowed for much faster development.

"Our technology is based on the standards of Java, which basically means that wherever the standard provides something, ULC leverages that," says Marc Domenig, Canoo's CEO. "Our library is very small and very lean." Domenig agrees that one benefit of AJAX applications is that they run within the browser without requiring a Java plug-in. And server-side programming models may start to emerge; Google offers an AJAX library that is server oriented. But for large scale enterprise applications, working in a mixed technology environment requires appropriate skill sets, has tremendous disadvantages for testing, and can prove unmanageable for a fairly large project, he says.

This fall, Canoo is planning to release ULC Mobile, built on Java 2 Micro Edition, for mobile applications and thin-client terminal devices by the end of the year. The company is also working on a ULC version of open source project SwiXMLcalled ULCXML, which will allow developers to create ULC GUIs from XML files.

About the Author

Kathleen Richards ([email protected]) is the editor of and executive editor of Visual Studio Magazine.