Tutorial: How To Build An RIA?
By Denis Sureau on July 3, 2007
The majority of the innovations in the field of development converge to only one direction: improvement of rich Web applications to facilitate their programming and their use, to increase performances and possibilities. As if RIA wanted to supplant the traditional desktop software. However, if new tools facilitate the programming, the new techniques also make it more complex and choices must be made before beginning the design of an RIA.
Description
Let us define an RIA as a Web application, a program hosted on a server and
executed on the browser, and which has all the functionalities of a local
application such as a word processing software. RIA is cleared from the slowness
of Internet applications and it has access to the files on the local computer,
contrary to Web scripts.
However, to take safety in account (one could be connected to a malicious
software) RIA ran inside a clean environment which is called sandbox.
To be able to get these advantages on Web applications, a runtime must be
downloaded on the client computer.
Perspective
Thanks to new technologies which we will detail and with new possibilities of which they are equipped, RIA have as well advantages on local applications as they can only replace them in the short run, tendency which is noted on all the plans: new development tools, investments and repurchases of companies, offers employment (administration of servers, webmasters).
Advantages
For the editor
The editor has a means of promotion for his application that is free and
considerable: search engines. It obtains from to the start a large audience
without expenses and distributing anything.
It is delivered of all the tasks of distribution, it is enough for him to
put the last version of the application on line.
Possibly it can supplement its incomes by adding publicities in the interface,
which will be put in day in real time.
For the user
No installation is necessary, except the framework, which will be common
to all applications. The application does not depend on the operating system
and functions under Linux as under Windows or Mac. The user always has the
last version. He uses the software on any station (except if its data are
saved locally). It does not fear viruses or material breakdowns.
Techniques of RIA
Asynchronous mode
The asynchronous mode consists to launch operations and to return the hand
to the user without awaiting the response from the server. RIA frameworks
incorporate Ajax
to allow this operating mode.
With that one can associate a function of prefetching, which consists to anticipate
the needs and to launch the requests to obtain the answers without waiting.
For example when a map is display, Google Maps downloads the adjacent areas
which are displayed then immediately when one moves on the map.
Sandbox
Si named because it is used it to perform tests. It is an environment of
execution equipped with a memory capacity and resources. Programs, mainly
libraries, do not have access to the files around on the computer out of the
allocated space. The Java virtual machine which makes function applets of
Web pages is an example. But that spreads with the other environments such
as XAML, XUL, etc.
On the contrary ActiveX do not function in a sandbox and require complex safety
measures.
Disconnected mode
An RIA should continue to work after one closed the Internet connection,
during a displacement for example. With this intention several techniques
are implemented.
- Databases are transferred on a local SQLite base.
- Resources such as Web pages and images are chosen and stored on the local
hard disk.
- The third function consists in transposing on the local station operation
on the Web. Thus Ajax must function locally, which is not allowed by the XMLHttpRequest
object in normal mode.
These three functions correspond to the three modules of Google Gear.
Dynamic pages
RIA is built from components of dynamic Web pages, therefore Ajax who includes JavaScript, DOM, CSS, the XMLHttpRequest object. RIA must be compatible with the standards of the Web to function on all browsers.
Web services
The application can use Web services, on the site of the application or coming from third sites and which achieve processing to provide specific information.
Framework
To this Web environment must be added a framework for the client side: the virtual machine Java, XULRunner, .NET, the flash player, etc.
Environments
The war of the environments started with the announce of Silverlight by Microsoft.
In front of it, exist various, different and incompatible origins solutions,
but Silverlight with its XML language of interface its portable and light
plug-in seems to want to crush competition and to replace Flash by a Microsoft
standard.
However the world of the Web reacted, Adobe announces an open source and free
development environment, the W3C takes into account HTML 5 to replace the
current format and Google proposes a plug-in to run RIA without connection.
Thus the programmer is faced to a wide panel of technologies:
ActiveX controls
For an application functioning under Internet Explorer, ActiveX controls
insert applications into a Web page. Often the editors provide a version of
the application under this format and another as a plug-in for Firefox.
The Silverlight environment uses an ActiveX control under IE. Let us give
an example of creation of control with Silverlight.
One defines the placement of the object with a div or other tag:
<div id="MyObject"></div>
Then one creates the object with a function of the plug-in:
<script language="text/javascript>
Sys.Silverlight.createObject("code.xaml", parent, "MyObject" ... other options ...);
</script>
Silverlight
The new framework of Microsoft, Silverlight exists in the form of a multi-platforms
plug-in in version 1.0, and version 1.1 dependent on the less portable framework
.NET but which adds the possibility of functioning without connection.
The interface is described in XAML and is coded in Javascript, or other languages
for the 1.1 version.
Flash
This binary format is displayed thanks to an ActiveX control under IE, and plug-ins for other browsers. Its advantage is that it is spread now enough and the developers can use it without fearing for compatibility.
JavaFX
The framework of Sun uses the syntax of the XML graphic format SVG to define interfaces and Java on server side. The editor proposes also a heavier solution, Java Webstart, entirely in Java.
Google Gears
It is not a framework in oneself but a complement to others frameworks to
enable them to compete with Silverlight. It could be incorporated in AIR of
Adobe which uses flash on the browser.
Gears
is composed of three modules making it possible to charge the resources of
the application on the local station and to reach it to carry out the application
without Web connection then.
HTML 5
New
HTML standard, whose definition is in progress, is designed for Web applications.
It will have a Canvas tag making it possible to draw graphic components, and
also more complete elements of forms.
Conclusion
Thus nothing is sure about that will be the future of Web applications, the environment which will be the main standard... It is not really in the possibilities of technologies offered that it will be necessary to make the choice to create an RIA, because they tend to be equivalent, but rather in a culture which would like to be placed in the wake of Microsoft or on the contrary to free itself from it.
(c) 2007 Denis Sureau. Scriptol.com