Introduction
A few years ago, in the field of creating Internet applications, there was a tendency to move from standard HTML / JavaScript / CSS technologies to platforms that allow you to run programs in a web browser environment that are not different from windowed (desktop) applications. This type of software products is called Rich Internet Applications (
RIA ), which means “rich Internet applications”. Despite the fact that some of the RIA technologies were released quite a long time ago (late 90s), they were widely distributed no more than 3-4 years ago.
Talk about the features of the RIA should start
with conceptual differences from HTML based applications. Regular services sites operate on the principle of switching to another page via hyperlinks and sending a form to the server using a web browser. In other words, the work of such applications is concentrated around a
client-server architecture with a
thin client . HTML, being a markup language for documents and displayed by the browser, is ideal for this. The sequence of user actions is the constant sending of requests to the server. With this approach, there are a number of problems:
- Saving user data between application sessions and synchronizing them with the server.
- The problem of sending and receiving data from the server only as needed, and not for every user action.
- The problem of running the application when not connected to the network.
What solution of these problems does the RIA concept offer? From an architectural point of view, it translates such programs into a category of applications with a fat client. All RIAs have a similar feature: the presence of an intermediate part that is transmitted over the network to the client and is responsible for interacting with the server and displaying the user interface, which is far superior to HTML counterparts. In Figure 1 you can see the principles of the organization of interaction with users in the case of HTML and RIA applications.

Figure 1 - Principles of HTML and RIA-applications
The solution to the problem of saving user data occurs at the expense of the RIA platform (platform-independent environment for launching RIA applications). The intermediate part downloaded from the network refers to it for saving and reading information. From here it is possible to send and receive data from the server only as needed, due to caching on the client side. The issue of unstable connection is also resolved. RIA platforms can install the application on the user's computer. This means that disk space will be allocated for program files and it can be launched without a network. Thus, it is possible to note the main distinctive features of the RIA:
- The client side of the application is loaded onto the user's computer, which is responsible for interacting with the server and has data caching and working capabilities without connecting to the network;
- runs in a browser or as a windowing application and requires installation of the RIA platform;
The gradual development of Internet standards has led to the implementation of such technologies in practice. The most famous at the moment are the following:
Table 1 - Most Common RIA Technologies
')
The choice of these products is due to the prevalence of the Internet and the fact that users have installed platforms for launching RIAs. In the following sections, compact applications will be created to demonstrate the basic technical features of each technology. The task of the programs is to obtain a brief statistics on the load of the application server after certain periods of time and display it to the user. In response to each request, the server sends the following data, packaged in
JSON :
- server domain name;
- full capacity of allocated memory;
- free memory;
- maximum amount of memory;
- the number of running threads.
In this way, the client parts of the demo applications are different, and on the server side their requests are serviced by a Java servlet.
Application on GWT
A brief description of the technology. The RIA developer creates the interface and logic of the program in Java, and GWT compiles the source code into carefully optimized JavaScript. The script file connects to the webpage and displays the application interface during the download. At the same time, firstly, the problem of having a special browser plug-in is solved - in fact, in the case of GWT, it is necessary to enable Javascript scripts (supported by all modern browsers). Secondly, GWT has a large library of components to create full-fledged RIAs, and their number is constantly growing, thanks to a large developer community. Based on these components, you can make traditional window interfaces in the browser.
Benefits:- Use smaller, more compact, cached Javascript code;
- Automatically support browsers IE, Firefox, Mozilla, Safari and Opera;
- The library includes tools for handling transition events in the list of previously visited pages in browsers (the “Back” button).
In addition, while working in Java, you can use:
- Debugging tools that allow you to monitor the values ​​of variables, work with breakpoints, etc .;
- Automated unit tests (based on Junit , etc.) both in the program and in the browser;
As for the contents of the libraries, the GWT includes:
- Built-in user interface components that serve as cross-browser application building blocks;
- Remote code calling helps with client-server interactions (RPC, AJAX);
- Tools for integrating GWT code into existing JavaScript code;
- Developer tools to simplify interaction with interface designers (UIBind).
disadvantages- Mandatory knowledge of Java. Despite the enormous popularity of this language in creating web applications, it will be extremely difficult for a beginner who does not know the basic principles of Swing or AWT user interfaces.
- Crossbrowser has its pitfalls. The components of the user interface that are part of the distribution are thoroughly tested and do work the same in all browsers. However, the community has released new components that should be treated with caution in different environments. The problem is the developer’s experience.
- The speed of the GWT compiler. This is an executable class in the Java language that takes source paths as arguments. In a small project author compile time reached 2 minutes. Alternatively, to run the application, you can use a special hosted mode when the project is not compiled, but is launched using special tools in the selected browser (GWT version 2.0). In addition, you can compile the project for only one browser by changing the configuration, which reduces the build time.
Application code snippetcurrentRequest = requestBuilder.sendRequest(query.toString(), new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
pleaseWaitLabel.setVisible(false);
if (response.getStatusCode() == 200 && response.getText() != null && !response.getText().equals("")) {
JSONValue resVal;
JSONObject resObject;
JSONString serverName;
JSONNumber totalMemory;
JSONNumber freeMemory;
JSONNumber maxMemory;
JSONNumber threadCount;
try {
resVal = JSONParser.parse(response.getText());
} catch (JSONException e) {
Window.alert(" . ");
return;
}
if ((resObject = resVal.isObject()) == null) {
Window.alert(" . ");
return;
}
if ((serverName = resObject.get("serverName").isString()) == null) {
Window.alert(" . ");
return;
}
…..............................................................................................................
setServerName(serverName.stringValue());
setTotalMemory(Integer.toString((int) totalMemory.doubleValue()));
setFreeMemory(Integer.toString((int) freeMemory.doubleValue()));
setMaxMemory(Integer.toString((int) maxMemory.doubleValue()));
setThreatCount(Integer.toString((int) threadCount.doubleValue()));
} else {
Window.alert(" . ");
}
}
public void onError(Request request, Throwable exception) {
pleaseWaitLabel.setVisible(false);
Window.alert(" . ");
}
});
Flex / AIR application
A brief description of the technology. Adobe Flex is a toolkit for developing RIAs on the Adobe Flash platform using ActionScript 3. Flash provides far more options than you can get from HTML in terms of interactivity. Nevertheless, Flash development is a very difficult process for simple programmers. Flash targets designers more. Flex removes this barrier by providing a software way of developing an RIA.
MXML , an XML-based language, is used to describe the user interface format and behavior, and ActionScript ™ 3, a powerful object-oriented programming language, is used to create a logical model for the behavior of a client program.
BenefitsRIA applications created in Flex can work in a browser using Adobe Flash® Player software, or as a regular program if the OS is running cross-platform Adobe AIR ™ application. Because of this, Flex applications can work with many common browser types as well as with desktop operating systems. When using AIR, Flex applications can access local PC data and system resources. However, the AIR security model will not allow damage to user information and system files by running applications in an isolated environment. Flash Player and Adobe AIR are available for free download on Adobe.com. Currently,
99% of PCs have Flash Player with one of the most recent versions (9 or 10). The user interface is created using MXML, a relatively simple and intuitive language, so experienced developers can learn it quickly.
disadvantages- The ActionScript language was originally a scripting language for the Flash player, which came up with changes in Actionscript 3. As an object-oriented language, it lacks a mass of features that Java or .NET developers take for granted.
- The number of third-party libraries (in particular, open-source) is orders of magnitude smaller than in Java.
- Although the Flex SDK is free, the Flex Builder core development environment is a commercial product.
Application code snippet<mx:HTTPService
contentType="application/x-www-form-urlencoded"
id="service"
method="GET"
resultFormat="text"
showBusyCursor="true"
url="/status"
fault="httpFault(event)"
result="httpResult(event)"
useProxy="false"
/>
public function httpResult(event:ResultEvent):void {
//get the raw JSON data and cast to String
pleaseWaitLabel.setVisible(false);
var jObj:Object = JParser.decode(event.result.toString());
serverNameValueLabel.text = jObj.serverName;
totalMemoryValueLabel.text = jObj.totalMemory;
freeMemoryValueLabel.text = jObj.freeMemory;
maxMemoryValueLabel.text = jObj.maxMemory;
threadCountValueLabel.text = jObj.threadCount;
}
public function httpFault(event:FaultEvent):void {
Alert.show(" , ");
timer.stop();
}
Java applet application
A brief description of the technology. A java applet is a byte-code java application. Java applets are executed in a web browser using a Java Virtual Machine (JVM), or in Sun's AppletViewer, a standalone applet testing tool. Java applets were introduced in the first version of the Java language in 1995. They are created in the Java programming language, but can also be written in other languages ​​that are compiled into Java byte code, such as Jython.
Benefits- cross-platform;
- applet is supported by most browsers;
- it is cached in most browsers, and therefore will be loaded quickly when returning to a web page;
- the level of access the applet to client data is configured by the computer user;
disadvantages- applet development requires a middle-level programmer to be proficient in Java, you must have an idea of ​​Swing or AWT libraries to create a user interface;
- It requires the installation of a Java extension, which is not available by default in all browsers. Currently, the plugin is installed on 90% of client PCs;
- to increase the security of the applet, access to the user system is limited: in particular, it does not have direct access to the client disk or the clipboard;
- Some organizations only allow software installed by administrators. As a result, many users cannot see applets by default.
- applets may require the use of a specific version of the JRE.
Application code snippetprivate void updateServerStatus() {
clearStatistics();
pleaseWaitLabel.setVisible(true);
Timer t = new Timer(3000, new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
try {
pleaseWaitLabel.setVisible(false);
URLConnection conn = new URL(url).openConnection();
String json = readStreamToString(conn.getInputStream(), "UTF-8");
JSONObject j = new JSONObject(json);
serverNameValueLabel.setText(j.getString("serverName"));
totalMemoryValueLabel.setText(j.getString("totalMemory"));
freeMemoryValueLabel.setText(j.getString("freeMemory"));
maxMemoryValueLabel.setText(j.getString("maxMemory"));
threadCountValueLabel.setText(j.getString("threadCount"));
} catch (Exception e) {
e.printStackTrace();
}
}
});
t.setRepeats(false);
t.start();
}
JavaFX application
A brief description of the technology. JavaFX is a platform for creating RIAs that can run on personal computers and mobile devices. JavaFX technology allows you to create applications for working with multimedia content, graphical user interfaces for business applications, games for personal computers and mobile devices, rich graphics, multimedia websites, etc. JavaFX applications are created using the
declarative programming language JavaFX Script. To develop applications in the JavaFX Script language, you need to download and install the JavaFX SDK. From code written in JavaFX Script, you can access any Java library. Therefore, the joint use of Java and JavaFX Script languages ​​allows solving various tasks, for example, the logic of a business application can be written in Java, and the graphical user interface can be written in JavaFX Script. Applications written in JavaFX Script can run on computers with installed Java 1.5 and higher. The following operating systems are currently supported: Windows, Mac OS X, GNU / Linux and Solaris.
Benefits- The JavaFX Script language supports the use of Java libraries and allows you to get compact code.
disadvantages- still there is a problem with running on client machines. JavaFX applets do not run in the Opera browser, it is still not clear what is with Linux systems. True, this situation is gradually being corrected - JavaFX 1.2, according to the creators, works on Ubuntu and OpenSolaris.
Application code snippetvar parser = PullParser {
documentType: PullParser.JSON;
onEvent: function (e: Event) {
if (e.type==PullParser.INTEGER and e.name.equals("freeMemory")) {
freeMemoryValueLabel.text = Integer.toString(e.integerValue);
}
if (e.type==PullParser.INTEGER and e.name.equals("maxMemory")) {
maxMemoryValueLabel.text = Integer.toString(e.integerValue);
}
if (e.type==PullParser.TEXT and e.name.equals("serverName")) {
serverNameValueLabel.text = e.text;
}
if (e.type==PullParser.INTEGER and e.name.equals("threadCount")) {
threadCountValueLabel.text = Integer.toString(e.integerValue);
}
if (e.type==PullParser.INTEGER and e.name.equals("totalMemory")) {
totalMemoryValueLabel.text = Integer.toString(e.integerValue);
}
}
}
Silverlight application
A brief description of the technology. Silverlight provides a graphical system similar to the
Windows Presentation Foundation , and combines multimedia, graphics, animation, and interactivity in a single software platform. It was created to work with
XAML and with Microsoft .NET languages. XAML is used for layout pages with vector graphics and animation. The platform includes a browser plugin that allows you to run applications containing animation, vector graphics and audio-video clips, which is typical for RIA.
Benefits- Starting from version 2.0, the program logic can be described in any of the .NET languages, including dynamic programming languages ​​such as Iron Ruby and Iron Python;
- The .NET platform is a powerful tool for developing business applications;
- A large number of third-party components from Infragistics, Syncfusion, Telerik (commercial products);
- A large community of .NET developers.
disadvantages- Silverlight is implemented for Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows 7, Mac OS X 10.4, Mac OS X 10.5 and Internet Explorer 6.0 / 7.0 / 8.0, Mozilla Firefox 1.5 / 2.0 / 3, Safari 3.1, Google Chrome 3.0. In the future, support for Opera is also planned. Existing browser extensions on other operating systems are still at the preliminary stage.
Application code snippetvoid refreshStatistics(object o, EventArgs sender)
{
WebClient proxy = new WebClient();
proxy.OpenReadCompleted += new OpenReadCompletedEventHandler(proxy_OpenReadCompleted);
proxy.OpenReadAsync(new Uri(uri));
}
void proxy_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
JsonObject jsObject = (JsonObject)JsonObject.Load(e.Result);
serverNameValueLabel.Text = jsObject["serverName"];
totalMemoryValueLabel.Text = jsObject["totalMemory"].ToString();
freeMemoryValueLabel.Text = jsObject["freeMemory"].ToString();
maxMemoryValueLabel.Text = jsObject["maxMemory"].ToString();
threadCountValueLabel.Text = jsObject["threadCount"].ToString();
}
findings
Conclusions about the comparison of modern RIA technologies and the results of the experiment on writing applications are presented in Table 2. Further, the comparison for each parameter is described in more detail.
Platform
| Gwt
| Flex / AIR
| Javafx
| Java applets
| Silverlight
|
Developer
| Google Inc.
| Adobe Inc.
| Sun Microsystems
| Sun Microsystems
| Microsoft
|
Creation language applications
| Java
| Actionscript
| Javafx script
| Java
| C ++, C # Visual Basic,
Object Pascal and many other
|
Support by browser customer
| 100% with the included Javascript
| ~ 97-98% of browsers
| ~ 70% of browsers
| ~ 70% of browsers
| ~ 50% of browsers
|
Study time for beginner
| 3-6 hours
| 3-6 hours
| 3-6 hours
| 3-6 hours
| 3-6 hours
|
Time on the development of a demonstration of the application
| ~ 1h
| ~ 2 hours
| ~ 3 hours
| ~ 1h
| ~ 3 hours
|
License
| Apache License 2.0
| Mozilla public License / Adobe AIR user- agreement
| Javafx user- soe agreement
| SUN / ORACLE user- agreement
| Microsoft user soe agreement
|
Facilities development
| Eclipse (is free), NetBeans (free)
| Adobe Flex (commercial cue product)
| Eclipse (is free), NetBeans (free)
| Eclipse (free but), NetBeans (free)
| Microsoft Web Developer Studio (free) but)
|
Creature interface in a graphical editor development tools
| Yes (with the presence of commercial chesky plug)
| Yes
| Not
| Yes
| Yes
|
Table 2 - Comparison of RIA technologies
Studying time for a beginner. A beginner in this case is considered a mid-level programmer who is not familiar with any of the technologies under consideration. According to the author, the writing of each application can take from three to six hours, if we consider the installation time of all necessary programs and reading the documentation.
Time to develop demo applications. The author of the article was familiar with the three technologies at the time of writing the applications, namely, GWT, Adobe Flex / AIR and Java Applets. So the maximum time for one program was 3 hours. Work with already known technologies lasted from one to two hours.
Browser client support. The fact that the client’s computer has the necessary platforms and extensions to launch the RIA can be judged by statistics from
http://riastats.com . The audience reachers are GWT and Adobe Flex / AIR. This is due to the fact that in the first case no additional programs are required to be installed, and in the second, the widespread use of the Adobe Flash player on the computers of Internet users affects.
This is followed by JavaFX and Java Applets technology, covering approximately 70% of users. The main condition for their work is the presence of an installed JRE on a PC. Libraries for JavaFX have been included in it since version 1.5, and applet support has been around for a long time. With Java technology, Applets had no problems running in the browser. In the case of JavaFX, the author never managed to do this and the application runs only in windowed mode. Perhaps this is due to a recent JavaFX update, when applications stopped running in the latest versions of Opera and Firefox browsers.
Licensing and entry costs for developers.- GWT is released under the Apache License 2.0. It gives the user the right to use the software for any purpose, freely distribute, modify, and distribute the modified copies. GWT can be downloaded for free from the developer’s website. Products written using GWT may have any license.
- Adobe Flex / AIR. The Flex SDK is available under the Mozilla Public License, and the Adobe AIR SDK is available under a user agreement with Adobe. Both products can be downloaded free of charge from the developer’s website. RIAs written using the Flex SDK and the AIR SDK may be released under any license.
- The JavaFX SDK is distributed under a user agreement with SUN / ORACLE. The license does not impose special restrictions on the distribution of JavaFX-based applications and they may be commercial ones as well.
- Java Applets. Components for Java Java Applets are part of the JRE library. They are available under a user agreement with SUN / ORACLE. JRE can be downloaded free of charge from the manufacturer’s website.
- Microsoft Silverlight is released under a user agreement with Microsoft. It does not impose special restrictions on programs written using the Silverlight SDK. The SDK is free to download from the Microsoft website.
Features of the organization of client-server interactionThe task of obtaining server load statistics in general consists of two stages. First, the implementation of the HTTP request to the server, and secondly, receiving data from the server response. For all examples, two objects are responsible for these actions in the application. The first one performs an HTTP request and, in the event of receiving a response, sends data to the second object. Next, it extracts the statistics data from the response and the user interface is updated.
The components responsible for implementing the HTTP request are included in the standard SDK library of each technology. However, with components that extract statistics data from a JSON response, the situation is different. If GWT, JavaFX and Silverlight are included in the SDK, then Flex / AIR also uses the JSwoof library (
www.waynemike.co.uk/jswoof ) for working with JSON, and for Java applets, the org.json package (
http : //json.org ) for Java.
Client-server interaction code can be compared by the number of lines. The results are in table 3:
Platform
| Gwt
| Flex / AIR
| Javafx
| Java applets
| Silverlight
|
Number of lines code for client-server organization interactions
| ~ 40
| ~ 30
| ~ 30
| ~ 20
| ~ 30
|
Table 3 - Comparison of the number of lines of code for the organization of client-server interaction
The presence of the necessary components in libraries.To write demo applications, two types of components were required:
- visual elements of the user interface;
- non-visual components for the organization of client-server interaction.
Table 4 discusses the availability of the necessary components in the standard SDK.
Technology
| Availability visual components
| Availability client-server components interactions
|
Gwt
| Yes
| Yes
|
Flex / AIR
| Yes
| Additionally used JSWoof to work with JSON
|
Javafx
| Yes
| Yes
|
Java applets
| Yes
| Additionally org.json package used to work with Json
|
Silverlight
| Yes
| Yes
|
Table 4 - Using SDK components
In the case of Flex / AIR and Java applets, additional libraries were used to create the example, which are not included in the standard SDK.
The way to describe the user interfaceTo describe the technology interfaces, use 2 approaches:
- using a programming language (GWT, Java Applets). In this case, all components are described in the source file in the form of variables. At the stage of launching an application, they are initialized in code and are located in the application window.
- by the declarative method, using a special XML-based language (XAML for Silverlight and MXML for Adobe Flex / AIR) and using JavaFX Script. In the source text, nesting of components is observed for their subsequent location on the screen. For Silverlight and Adobe Flex / AIR, it is characteristic that the source code of the program and the XML description of the interface can be stored in one file.
The approaches used in Silverlight, Adobe Flex / AIR, and JavaFX make it possible to separate the interface description and the application code. In this direction, the latest version of GWT offers the UIBind tool for organizing collaboration between HTML designers and programmers. The source code can include files with HTML-code, which are embedded elements of the user interface. At the compilation stage, they will be associated with the program code. This allows you to work separately on the design in HTML.
Technical documentation and developer community. Information resources on each technology can be divided into three categories:
- official technical documentation on the developer's site;
- articles with examples of the use of technology that are in blogs and other information resources;
- forums dedicated to a particular technology.
GWT:
Adobe Flex / AIR
JavaFX:
- javafx.com is the official site of technology developers, useful in that it has links to JavaFX community resources devoted to documentation and sample programs.
- blogs.sun.com/javafx is a JavaFX blog.
Java Applets:
- java.sun.com/applets is a page on the SUN / ORACLE website about Applets Java technology. There are technical documentation and sample applications, as well as links to forums and other resources.
Silverlight
The interest of developers in a particular technology, and therefore the creation of communities can be indirectly judged by the number of projects, for example, in the Google Code catalog (http://code.google.com). On the other hand, an important role is played by the number of job offers for each technology (website
indeed.com ). The data are presented in table 5 and figure 2:
Platform
| Gwt
| Flex / AIR
| Javafx
| Java applets
| Silverlight
|
amount projects in the Google Code directory
| 1475
| 2388/703
| 119
| 166
| 180
|

Figure 2 - Number of RIA developer jobs
The choice of technology, the most suitable for solving the problemAccording to the author, it is impossible to say that some of the technologies is a priority for solving the problem. The fact is that in the initial conditions there were no restrictions on the software of client computers, special modes of operation, etc. As for the task, it can be successfully solved with the help of each technology with the same success. This can be judged by written demo applications.
Source code can be downloaded
here (project InelliJ IDEA 9)