Welcome!

Coach Wei

Subscribe to Coach Wei: eMailAlertsEmail Alerts
Get Coach Wei via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: RIA Developer's Journal, Apache Web Server Journal, SOA & WOA Magazine, Java Developer Magazine, AJAX World RIA Conference

RIA & Ajax: Article

AJAX, Java, Flash, and .NET

Rich Internet applications market place

General RIA Programming Model
Although there are many different RIA solutions based on different underlying technology platforms, the general RIA programming model is actually converging into a single common model.

Declarative UI Development
The general RIA programming model is centered on using an XML-based UI markup language to create a rich user interface. The XML-based UI markup provides a much higher level of abstraction than HTML for building rich user interfaces. XML UI frees programmers to focus on the application's core logic and explicitly complements the roles of a typical enterprise development team (see reference "XML for Client-side Computing").

Below are examples from a scripting-based approach (Laszlo Systems) as well as an OOP-based approach (Nexaweb). Both are zero-install and can run inside any popular Web browser today without any software download.

On the client side, Laszlo requires a Flash engine (Flash 6 and above) while Nexaweb requires a JVM (JDK 1.1 and above).

Laszlo is a Flash-based RIA solution. It uses an XML UI markup language called "lzx" to describe the UI and uses ActionScript to code application logic. (See Figure 1) The Laszlo server will automatically compile lzx files into the Flash binary format (SWF), deliver the SWF files for rendering inside a Flash engine, and execute the application. Following is an example of the Laszlo code:

<canvas height="450">
   <window x="10" y="10" width="300" height="200" title="my window" resizable="true" closeable="true">
      <button x="10" y="100">Hello, World</button>
   </window>
</canvas>

By comparison, Nexaweb is a Java-based RIA product. Developers would use an XML-based UI markup to create a rich user interface and build client-side business logic by writing client-side Java objects called Managed Client Objects that are standard Java program objects. (See Figure 2) The Nexaweb client runtime dynamically renders the XML UI markup to present a rich user interface, and dynamically downloads client-side Java objects to the client side for execution in a "on-demand" fashion. Here is a simple Nexaweb UI that defines a tree and a button managed by a layout manager:

<xal xmlns="http://www.openxal.org/xal">
   <window title="New Window">
   <boxLayout orientation="vertical" pack="start" align="stretch"/>
     <tree>
       <column/>
         <row expanded="true">
           <cell text="Tree Item 1"/>
           <row>
             <cell text="Sub Tree Item 1"/>
           </row>
           <row>
             <cell text="Sub Tree Item 2"/>
           </row>
         </row>
         <row expanded="true">
           <cell text="Tree Item 2"/>
           <row>
             <cell text="Sub Tree Item 3"/>
         </row>
       </row>
     </tree>
       <button text="OK"/>
   </window>
</xal>

As shown in these two code examples, though Nexaweb uses Java and Laszlo uses Flash, RIA UI development is conceptually identical between the two different RIA solutions.

Application Logic Development
RIA solutions enable a wide range of options for application logic development. In typical HTML applications, most of the logic has to be on the server side. In typical desktop applications, most of the logic resides on the desktop. RIAs offer significant flexibility so developers put the logic either on the client side or server side. They can also adjust the location - ranging from very limited logic on the client side all the way to almost 100% logic on the client side, as shown in Figure 3.

The flexibility in partitioning application logic brings significant benefits. Some applications are best suited to having all their logic centralized on the server side while other applications require that the logic run on a local desktop. Traditionally, developers have to make tradeoffs depending on whether they choose to build the application as Web application or a desktop application, and bear with the problems associated with that particular choice. RIAs combine the best of both worlds, enabling developers to meet different application requirements without making costly tradeoffs.

In contrast to UI development, the choice of a particular RIA approach - Java, AJAX, .NET, or Flash - has a direct impact on and creates significant differences in application logic development. Choosing a scripting-based solution requires that the logic be written as scripts, which limits the amount and scope of logic that can be developed and maintained cost-effectively. An OOP-based RIA solution gives maximum flexibility to logic development and maintenance, but requires a higher-level skill set than scripting.

There's a code sample of logic development using Laszlo in Listing 1.

By contrast, OOP-based approaches use an object-oriented true programming language for the application logic development and typically enforce separation between the logic and the UI markup. For example, Nexaweb uses standard Java for the application logic called mco. Nexaweb also enforces a clear separation between the UI and logic, preventing the mixing of the UI with the logic in the same document for better application maintenance. (See Figure 4) Nexaweb separates the UI from the application logic:

<xal>
   <mco:declarations xmlns:mco="http://nexaweb.com/mco">
     <mco:mco id="myMco" src="com.nexaweb.test.MyTestMco"/>
</mco:declarations>

   <dialog title="Login Dialog">
     <boxLayout orientation="vertical" pack="start" align="start"/>
     <label text="Username:"/>
     <textField height="25" text="enter username here..." width="200"/>
     <label text="Password:" />
     <textField height="25" text="enter password here..." width="200"/>
     <panel height="25" width="100"/>
     <button height="25" text="Button" width="100" onCommand="mco://myMco.handleOnCommand()"/>
   </dialog>
</xal>


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.

Comments (7) View Comments

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.


Most Recent Comments
Joe 09/20/06 04:43:35 AM EDT

I would like to point to a new framework I found for doing RIA the object oriented way but still resulting in standard DHTML/AJAX. Check this live sample here http://samples.visualwebgui.com/mainform.wgx and find more info here http://www.visualwebgui.com.

n d 09/19/06 04:00:34 PM EDT

Enterprise Rich Internet Applications (RIAs) are the next evolution of business application development. There are four different approaches to RIA development - AJAX, Java, Flash, and .NET - and many different RIA solutions available today. This article answers the following questions: What are enterprise RIAs? Which approach should you use? Which solutions are appropriate for you? And how are RIAs being adopted today?

j j 09/19/06 03:34:31 PM EDT

Enterprise Rich Internet Applications (RIAs) are the next evolution of business application development. There are four different approaches to RIA development - AJAX, Java, Flash, and .NET - and many different RIA solutions available today. This article answers the following questions: What are enterprise RIAs? Which approach should you use? Which solutions are appropriate for you? And how are RIAs being adopted today?

j j 09/19/06 03:28:22 PM EDT

Enterprise Rich Internet Applications (RIAs) are the next evolution of business application development. There are four different approaches to RIA development - AJAX, Java, Flash, and .NET - and many different RIA solutions available today. This article answers the following questions: What are enterprise RIAs? Which approach should you use? Which solutions are appropriate for you? And how are RIAs being adopted today?

AJAX SUX 08/27/06 03:39:39 AM EDT

AJAX SUX.
Javascript is the number 1 culprit of popup ads, browser hijackers, virus infectors, pop unders, browser crashes, hangs, gaudy annoying banner advertisements, flashing blinking ad-rotators, dumb rollover buttons, forms that don't work, ONLOAD crap, window resizers, dorky little mouse pointer trails that look like little bouncing balls following your little mousie all around like a junior high school myspace page caliber web programmer, stupid little purple scrollbars, incompatible browsers, exploit hooks, automatic download links that don't work, etc etc.

In fact, there is now a world wide movement to get RID OF JAVASCRIPT. Javascript is on its way out. People are already annoyed with it and are boycotting sites and advertisers that use Javascript and they are preferring sites that use normal standard HTML.

any websites that continute to use Javascript are dumped and nobody visits them and those companies using gratuitous and unnecessary Javascript on their sites are blacklisted. Form buttons, form validators, anything. Any programmer using Javascript = Loser.

Greg Holmberg 08/01/06 01:35:05 PM EDT

As usual, Wei conveniently leaves off the list one of the best designed and most efficient solutions in the Java-based category: UltraLightClient from Canoo.

http://www.canoo.com/ulc

The server-side API is almost identical to the Swing API, the network protocol is highly optimized and puts just 1/10th the data on the network as HTML, and there is a plug-in to Eclipse for GUI building.

JDJ News Desk 07/28/06 11:02:36 AM EDT

Enterprise Rich Internet Applications (RIAs) are the next evolution of business application development. There are four different approaches to RIA development - AJAX, Java, Flash, and .NET - and many different RIA solutions available today. This article answers the following questions: What are enterprise RIAs? Which approach should you use? Which solutions are appropriate for you? And how are RIAs being adopted today?