Direct RIA: Future of RIA

Direct RIA: Future of RIA

More choices, difficult decision

Though enterprises can benefit from Rich Internet applications, adopting new technologies can also introduce risk. The first problem is how to choose the right solution as it is easy to make a wrong decision because of too many choices, unclear criteria, and complex requirements.

Productivity or Controllability

RIA solutions can be generally classified into two categories - client centric or server-centric. Client-centric frameworks are like manually transmission car which provide more control, but requires more effort. Unlike client-centric frameworks, server-centric frameworks are like auto transmission cars which is easy, thus, they can boost developer's productivity by making AJAX technology transparent to developers. But, which to choose remains a headache. Full control or productivity? Can we benefit from both of them at the same time? The best case is that they can choose either way to satisfy different requirements like manually auto-transmission car!

Direct RIA = client+server fusion approach

Direct RIA enables a revolutionary client+server fusion approach which attempts to leverage benefits of productivity and controllability at the same time.programming when they require full customization, or more responsiveness.

Architecture Overview of Direct RIA

Direct RIA is a server-centric solution plus optional client-side programming. If you take a look at the following diagram, you can see that in the server-centric programming model allow developers to build the Web application using pure server-side code. The server-side engine will generate required HTML, and JavaScript code automatically. Then, the client-side engine will interact with the DOM tree to refresh the content. Moreover, the synchronization between the browser and the server is automated by the corporation of the client-side, and server-side Ajax engines. Thus, developers can focus on the application itself instead of the complex Ajax technologies.

However, one of the major disadvantages of pure server-centric programming model is that developers cannot fully control the presentation of user interface. To overcome this issue, Direct RIA enables an optional client-side programming model that enables developers to write client code to control the user interface directly if necessary.

Direct RIA: Future of RIA

Direct RIA Programming Model

Direct RIA programming model include direct UI access, direct data access, direct live data, and direct client control.

Direct UI Access

Since the application is running on the server side, the application can access widgets directly. Take ZK as an example, we create a Java 2D object at the server, and we simply put this object into the widget, and users will see the image on their browsers once they click the button.

<image id="image">
<button onClick='draw(10,10,10,10)'/>
  void draw(int x1, int y1, int x2, int y2) {
  LiveImage li = new LiveImage(400, 300, LiveImage.TYPE_INT_RGB);
  Graphics2D g2d = li.createGraphics();
  Line2D line = new Line2D.Double(x1, y1, x2, y2);  
  image.setContent(Images.encode("test.png", li));
With Direct RIA, developers no longer bothered by the client-side programming. In other words, they can kick-off the project quickly without learning many client-side related technologies.
-No more client-side programming.

Direct Data Access

Moreover, the application can access server resources easily; including database, web services directly since both the frontend and backend is running on the server side. The following example illustrates a simple scenario to get data from database, and displays it to users using ZK framework. Once the user clicks the button, there appears a welcome message.

Hi. <label id="name"/>
  <attribute name="onClick">
  User usr = Database.getUserById(1);
One of the most difficult challenges of creating Web application lies in the asynchronous programming model which includes various steps to get data from the server, and update the DOM tree accordingly. But, with Direct RIA, the frontend and backend are integrated seamlessly.
-No more asynchronous communication

Direct Live Data

With live data, developers could separate the data from the view. Developers only provide the data by implementing the ListModel interface enabled by ZK framework rather than manipulating the grid directly.

    String[] data = new String[1000];        
    for(int j=0; j < data.length; ++j) {        
        data[j] = "option "+j;            
    ListModel strset = new SimpleListModel(data);        
<grid width="100px" height="100px" model="${strset}">    
        <column label="options"/>            
The grid sends the data to the client only if it is visible. It saves a lot of network traffic if the amount of data is huge.
-No more scalability issue

Direct Client Control

With Direct Client control, developers can create widgets using either JavaScript or markup language, and implement the function at the client to improve responsiveness. In the following example, we demonstrate an example how to implement a simple function to display users' input with pure-client programming using ZK's markup language.

<page id="main">
<textbox id="searchBox"/>
<label id="value">

zk.zuml.Parser.createAt('#main', null, null, function (page) {
	page.$f('searchBox').listen({onChanging: function (event) {
Developers are free to customize a function at the client-side to satisfy their various requirements.
-No more customization issue

Direct RIA is the Future of RIA

It's never an easy task to build a enterprise application, not to mention enrich its user interface at the same time. Moreover, it's not easy to choose a right solution form 200+ solutions to satisfy various requirements. Direct RIA provides a client+server fusion approach that developers can boost their productivity using the Direct RIA programming model to access both the frontend and backend directly; moreover, developers are free to implement a function at the client if necessary. Direct RIA points out a total solution for developers they can leverage benefits of productivity and controllability at the same time.

This article was originally published on October 9th, 2009

About the Author

Robbie Cheng

Robbie Cheng is an Evangelist of the ZK framework. He is the principal developer of ZK Mobile for Android and ZK Forum. He is the co-author of the book "ZK: Ajax without the Javascript Framework" and has published many articles on AJAXWorld Mgazine, TheServerSide, and Javalobby. He has also spoken at various events, Google Developer Day, Mobile Monday, and OSDC 2009.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date