Building Rich Internet Applications With A Direct Ria Solution


Published on

Building an enterprise application is never an easy task, not to mention enriching its user experience at the same time. Scaring JavaScript spaghetti, tedious asynchronous communicate between client and server, and the danger of exposure of business logic to the client make Web application complex, less secure, and un-maintainable.

Published in: Technology, Business
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Hi, My name is robbie cheng. I am technology evangelist of the ZK framework. [break] Today, I am going to give to a brief introduction of the Direct RIA solution, and how it can help to create a rich internet application.
  • Here is today’s agenda, in the beginning, I will talk about what’s the benefit of rich internet application. What are those difficulties of building it. [break] Then, I will introduce you the Direct RIA solution, and take ZK framework as an example. [break] And last, we will enter a brand new world with the help of Direct RIA solution.
  • Due to the convenience of Internet, we can access the application anytime, anywhere, and any device.
  • Here is another example. Ajax coming in and it is user friendly. The signup application give you real time response in this case whenever something wrong and the error message near by the field that cause the problem. You typing a login user name that is already used by someone else, and it responds immediately beside the field that causing the error. This is user friendly. [next]
  • Google Maps was released in early 2005. It’s a benchmark of Ajax application. You can drag and move the map around naturally. It’s like to use desktop application while it’s a pure Web application. The most important thing regarding this is that: General users start to know that web applications can be made very user friendly. In the past, they are taught that web application is naturally by technology impossible to be made user friendly and they have to live with it if they want to do internet application. Now users will demand this kind of solution and you cannot say that is “impossible”. In fact, someone as old as I am with some experiences using the legacy web map service will appreciate this very much. The legacy map will “fresh” the whole page whenever you make a small move, zoom in, zoom out, etc. It was almost unusable.
  • Internet gives us the ubiquitous connectivity but, at the same time, it is hard to use. [click][break] Here Ajax fits in. We not only stronger but also faster.
  • As you might know that there are more than 2 hundred ria frameworks, it becomes more difficult to make a right decision. RIA represents rich internet application, it includes ajax, flex, and silverlight technologies. In these four categories, both snippet and widget frameworks emphasize on UI enhancement by introducing more animations, or off-the-shelf components. But what really matters to enterprise application is backend integration. Client framework only provides limited backend integration. The full framework is a complete solution, providing not only a rich widget set but also supporting data access and back-end service integration. It delivers a responsive user experience as well as enterprise values. If you’re going to enhance your existing web pages, you might choose snippet or widget frameworks. But, if you’re looking for a solution which provides not only the ui enhancement but also the backend integration. You should choose full framework. Actually, I wrote an article about how to choose an ria solution for ajaxworld magazine, you can refer to the following link. And remember this, right tool for the right job. One of its major benefits is that it usually introduces a simplified programming model without the baggage of client-side technologies. 
  • Here is some ria frameworks classified in to four categories. For example, jQuery can be used for ui enhancement of existing web pages. Ext-JS is a widget library, but it doesn’t support backend integration. GWT is a java-to-javascript framework, and it provides limited server integration thru remote procedure call, but it only provides few widget set. ZK, Flex, and Silverlight are located in the full framework category. they are designed to create enterprise application, and which to choose depend on your server side technology, ZK for java, and Silverlight for .net.
  • Let’s take a look at the problem of traditional programming model which is provided by many other RIA frameworks. As you can see, your application are running on two sides, the browser side, and the server side. Most ria frameworks only provide a widget set to enhance the ui, but the real problem for developers is how to exchange data between client and server, especially for enterprise applications. The procedure of exchanging data between client and server is complicated, and tedious. Moreover, here are more issues of the traditional programming model. two-sides programming Client knowledge Exchange data manually Security issue (your business logic are running on the client side which could be hacked) Maintenance issue (once your business logic is changed, you not only modify the server code, but also the client code) Enterprise RIA Issues
  • Since enterprise application is already complex, which requires frequent data exchange between client and server. And, introducing RIA technology makes this problem even worse. Developers have to focus on the ria stuff instead of the application itself. Direct RIA aims at resolving this problem by providing a simple programming model which makes ria technology default enabled, and developers can focus on the application instead of ria stuff.
  • Unlike most ria frameworks, direct ria simplifies the programming model by allowing the application running on the server side only, instead of two sides. Developers no longer to worry about the data exchange issue between client and server. Moreover, most issues of traditional programming model could be resolved at once since your application are no longer running on the client side. The ria technology is handled by zk automatically. it’s just like desktop programming, you don’t have to take care how the display card project your frontend.
  • Unlike other ria frameworks which requires developer to access the UI thru asynchronous communication , ZK allows developers to access the ui directly. In the following example, we use Java 2D to draw a square, and put it into the image component directly.
  • In addition to direct UI access, ZK allows developers to access data directly without asynchronous communicaiton, either. In the following example, we retrieve a user’s name from database, and put it into a label directly. It is such simple!
  • In addition, to simply the problem of binding data and view, ZK provides Data Binding, and annotation that allows developers to associate each other with an intuitive way. ZK will automates the binding between view and model automatically. Developer simply tells zk their association using data-binding, and annotation.
  • <zk > <window title="My First Window" border="normal" width="300px"> <hbox> Your Name:<textbox id="tb" value="Robbie"/> </hbox> <button label="Hi" onClick="doClick()" /> <zscript><![CDATA[//@DECLARATION public void doClick(){ alert("Hello "+tb.getValue()); } ]]></zscript> </window> </zk>
  • Please open your browser. My preference is Firefox. However, you can use Micorsoft Internet Explorer, Apple Safari, or Opera. ZK supports them all. Now in location box of your browser, type the URL shown on the slide. This is our Live Demo. <show my browser view> The left hand side is the list of ZK supported components in different categories. <show window, chart, Google Maps, back to the First Window> The right hand side is the sample codes and view of the selected components. Now click on the title of the Source panel, you can see the source panel opened. Inside is the source codes as shown on the View panel. This is a really Live demo. You can try your codes in Source Panel and see the reflection in View Panel. A lot of ZK users use it to try out their codes or even use it as a quick prototyping tool. Later on, I will request you guys to install a ZK framework and deploy the ZK Demo to your local machine. So you can try it out directly on your computer.<back to slide> <click> You can type codes here <click> and press Try Me! Button to see the view of your source codes.
  • With ZK’s markup and script language, developers can build the prototype of ui quickly. And script language supports real-time compilation so developer can modify the ui according to users’ requirement right the way to shorten the communication effort. And zk supports five script languages allows developer to use their preferred language.
  • 80 line
  • Building Rich Internet Applications With A Direct Ria Solution

    1. 1. Robbie Cheng, Technology Evangelist, ZK Framework June 23, 2009 ZK Building Rich Internet Applications with a Direct RIA Solution
    2. 2. Agenda <ul><li>RIA: Promise and Challenge </li></ul><ul><li>Direct RIA - ZK: Simple and Rich </li></ul><ul><li>Brand New World </li></ul>
    3. 3. <ul><li>RIA: Promise and Challenge </li></ul><ul><li>Direct RIA - ZK: Simple and Rich </li></ul><ul><li>Brand New World </li></ul>
    4. 4. The Internet is the Application EJB, BPM, MQ, Web Services, SAP R/3, Oracle 10 g , Notes <ul><li>Any time </li></ul><ul><li>Any where </li></ul><ul><li>Any device </li></ul>
    5. 5. Web applications are great in every measurement, except no user wants to use it.
    6. 6. User Frustration Where are these fields? Where are what I entered?
    7. 7. User Friendly Sign Up [source: remember the milk] Real Time Response
    8. 8. Google Maps Drag and Move Around [Source: Google Maps]
    9. 9. Why RIA? <ul><li>Rich, engaging user experience </li></ul><ul><li>Cross platforms support </li></ul><ul><li>Minimize network traffic </li></ul>
    10. 10. [Source: Forrester Resource] User Interface Evolution
    11. 11. Complex Ajax Technology
    12. 12. <ul><li>Complex Technology Stack </li></ul><ul><ul><li>JavaScript, CSS, XHTML, Document Object Model, XML </li></ul></ul><ul><ul><li>Browser incompatibility </li></ul></ul><ul><li>Complicated Programming Model </li></ul><ul><ul><li>XMLHttpRequest object for asynchronous communication </li></ul></ul><ul><li>Less Secure </li></ul><ul><ul><li>Plaintext JavaScript code </li></ul></ul><ul><li>Less Maintainable </li></ul><ul><ul><li>Client code and server code </li></ul></ul>Challenges of Ajax Applications
    13. 13. Why so complex? Windows Programming Client/Server Programming Web Programming Ajax Programming J2EE Programming
    14. 14. <ul><li>RIA: Promise and Challenge </li></ul><ul><li>Direct RIA: ZK – Simple and Rich </li></ul><ul><li>Brand New World </li></ul>
    15. 15. RIA Categories <ul><li>Reference </li></ul><ul><ul><li>How to Choose an RIA Solution , AJAXWorld Magazine </li></ul></ul>Enterprise Value Complexity
    16. 16. RIA Frameworks <ul><li>Snippet Framework </li></ul><ul><ul><li> Prototype,  Scriptaculous ,  jQuery </li></ul></ul><ul><li>Widget Framework </li></ul><ul><ul><li>Dojo,  Ext-JS ,  YUI </li></ul></ul><ul><li>Client Framework </li></ul><ul><ul><li>Flash ,  Java FX ,  GWT </li></ul></ul><ul><li>Full Framework </li></ul><ul><ul><li>ZK  ,  Richfaces , Flex,  Silverlight </li></ul></ul>
    17. 17. Typical Programming Model <ul><li>Client Side Programming </li></ul><ul><li>Complicated Client and Server Communication </li></ul><ul><li>Danger of Exposure of Business Logic </li></ul><ul><li>Maintenance Headache </li></ul>Application Application Browser Server components Ajax engine
    18. 18. What is Direct RIA <ul><li>A technology to increase developer’s productivity by integrating frontend and backend of applications transparently to deliver rich, and engaging user experience. </li></ul>
    19. 19. Direct RIA Programming Model <ul><li>No Client Side Programming </li></ul><ul><li>No Complicated Client and Server Communication </li></ul><ul><li>No Danger of Exposure of Business Logic </li></ul><ul><li>No Maintenance Headache </li></ul>Browser Server components components ZK client engine ZK server engine Application
    20. 20. Direct UI Access <ul><li>No asynchronous communication </li></ul><ul><li><zscript> </li></ul><ul><li>void draw(int x1, int y1, int x2, int y2) { </li></ul><ul><li>LiveImage li = new LiveImage(400, 300, LiveImage.TYPE_INT_RGB); Graphics2D g2d = li.createGraphics(); </li></ul><ul><li>Line2D line = new Line2D.Double(x1, y1, x2, y2); </li></ul><ul><li>g2d.draw(line); </li></ul><ul><li>image .setContent(Images.encode(&quot;test.png&quot;, li)); </li></ul><ul><li>} </li></ul><ul><li></zscript> </li></ul><ul><li><image id=&quot; image &quot;> </li></ul><ul><li><button onClick='draw(10,10,10,10)'/> </li></ul>
    21. 21. Direct Data Access (1) <ul><li>No asynchronous communication, either </li></ul><ul><li>Hi. <label id=&quot; name &quot;/> </li></ul><ul><li><button> <attribute name=&quot;onClick&quot;> </li></ul><ul><li>User usr = Database.getUserById(1); </li></ul><ul><li>name.setValue(usr.getName()); </li></ul><ul><li></attribute> </li></ul><ul><li></button> </li></ul>
    22. 22. Direct Data Access(2) <ul><li>Data Binding and Annotation </li></ul><ul><li><listbox rows=&quot;4&quot; model=&quot;@{persons}&quot; > </li></ul><ul><li><listhead> </li></ul><ul><li><listheader label=&quot;First Name&quot; width=&quot;100px&quot;/> <listheader label=&quot;Last Name&quot; width=&quot;100px&quot;/> </li></ul><ul><li><listheader label=&quot;Full Name&quot; width=&quot;100px&quot;/> </li></ul><ul><li></listhead> </li></ul><ul><li><listitem self=&quot;@{each='person'}&quot; > </li></ul><ul><li><listcell> <textbox value=&quot;@{person.firstName}&quot; /> </listcell> <listcell> <textbox value=&quot;@{person.lastName}&quot; /> </listcell> <listcell label=&quot;@{person.fullName}&quot; /> </listitem> </li></ul><ul><li></listbox> </li></ul>
    23. 23. What is ZK ? <ul><li>Direct RIA solution </li></ul><ul><li>Open source </li></ul><ul><li>Pure Java </li></ul><ul><li>Event-driven , Component-based </li></ul><ul><li>Markup & Script Languages </li></ul><ul><li>Standards-based </li></ul><ul><ul><li>XUL/XHTML </li></ul></ul><ul><ul><li>Java EE </li></ul></ul><ul><li>Extensible </li></ul>
    24. 24. ZK – First Touch <ul><li>Only one file required. </li></ul>
    25. 25. ZK Explorer <ul><li> </li></ul>
    26. 26. Rich Component Set Inputs Chart Checkbox & Radio Combobox Fileupload Window Menu & Toolbar Slider Captcha
    27. 27. Rich Component Set (Cont. 1) Tabbox Grid & Listbox Tree Layouts
    28. 28. Rich Component Set (Cont. 2) Google map FCKEditor Timeline
    29. 29. Rich Component Set (Cont. 3) Spreadsheet
    30. 30. Markup + Script Languages <ul><li>Markup + Script Languages </li></ul><ul><li><window id=&quot;win&quot; title=&quot;Script in Java&quot; width=&quot;100%&quot; border=&quot;normal&quot;> </li></ul><ul><li><zscript language=&quot; java &quot;> </li></ul><ul><li>FCKeditor fck = new FCKeditor(); </li></ul><ul><li>fck.setParent(win); </li></ul><ul><li></zscript> </li></ul><ul><li></window> </li></ul><ul><li>Various Script Languages Supported </li></ul><ul><ul><li>Java </li></ul></ul><ul><ul><li>Groovy </li></ul></ul><ul><ul><li>Ruby </li></ul></ul><ul><ul><li>JavaScript </li></ul></ul><ul><ul><li>Python </li></ul></ul>
    31. 31. MVC (Model-View-Controller) Approach <ul><li>ZUML as View </li></ul><ul><li>Java Code as Controller </li></ul>
    32. 32. Pure Java Approach
    33. 33. Event Driven <ul><li>Component Events (name start with ‘on’) </li></ul><ul><ul><li>onClick, onSelect, onChange, … </li></ul></ul><ul><ul><li>In ZMUL </li></ul></ul><ul><ul><li>In Java </li></ul></ul><ul><li>Fire the Event </li></ul><ul><ul><li>“onClick”,target,data); </li></ul></ul><ul><ul><li>Events.send(“onClick”,target,data); </li></ul></ul>
    34. 34. [Example]Stock Watcher (ZUML)
    35. 37. Server Push <ul><li>Reverse-Ajax, Server send content to the client actively. </li></ul>
    36. 38. Component Customization- Macro Component <ul><li>Any ZUL page can become a Macro Component </li></ul>
    37. 40. Integrate with HTML <ul><li>.zhtml </li></ul><ul><ul><li>use namespace ‘’ to mashup zul </li></ul></ul>
    38. 41. Integrate with JSP <ul><li>Use tag lib: </li></ul>
    39. 42. ZK Mobile – Ubiquity Access
    40. 43. <ul><li>RIA: Promise and Challenge </li></ul><ul><li>Direct RIA - ZK: Simple and Rich </li></ul><ul><li>Brand New World </li></ul>
    41. 44. Direct RIA = Simple + Rich EJB, BPM, MQ, Web Services, SAP R/3, Oracle 10 g , Notes <ul><li>Any time </li></ul><ul><li>Any where </li></ul><ul><li>Any device </li></ul><ul><li>Rich </li></ul><ul><li>Responsive </li></ul><ul><li>Low cost </li></ul>
    42. 45. Thank you!