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)'/>
  <zscript>
  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);  
  g2d.draw(line);
  image.setContent(Images.encode("test.png", li));
 }
 </zscript>
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"/>
<button>
  <attribute name="onClick">
  User usr = Database.getUserById(1);
          name.setValue(usr.getName());
  </attribute>
</button>
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.


<zscript>    
    String[] data = new String[1000];        
    for(int j=0; j < data.length; ++j) {        
        data[j] = "option "+j;            
    }        
    ListModel strset = new SimpleListModel(data);        
</zscript>    
<grid width="100px" height="100px" model="${strset}">    
    <columns>        
        <column label="options"/>            
    </columns>        
</grid>
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">
</page>

<script>
zk.zuml.Parser.createAt('#main', null, null, function (page) {
	page.$f('searchBox').listen({onChanging: function (event) {
		page.$f('value').setValue(event.data.value);
	}});
</scrpit>
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.



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.

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: September 10, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild". This loop of continuous delivery and continuous feedback is …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds