The Technology behind Rich Internet Applications

[article]
Summary:

Alejandro Felipe writes on the technology behind rich internet applications (RIA) in service-oriented architecture (SOA). With this knowledge, you'll be better able to build and support web applications using technologies such as Ajax and JavaScript and development frameworks, including BackBone Router and Model View Controller (MVC).

As a software developer, I often find that my build engineering and IT operations colleagues lack the technical expertise to support the systems that I develop. However, the DevOps movement is helping many technology professionals realize the importance of close collaboration between development and operations. In this article, I am going teach you about the technology behind rich internet applications (RIA) in service-oriented architecture (SOA). With this knowledge, you'll be better able to build and support web applications using technologies such as Ajax and JavaScript and development frameworks, including BackBone Router and Model View Controller (MVC).

Building and releasing these applications is actually not that complex. As a developer, I build these applications myself using Ant scripts, which I use to automatically create both the war file and the application itself. Here is some background on the technology that we are building.

Every day, developers are asked to develop web applications that are similar to and provide the same user experience as desktop applications. One common problem in web applications is the constant page reloads and flickering when navigating the application. We can use Ajax and JavaScript to avoid the flickering and reloads that users often complain detract from the interface. This allows us to effectively work from a single page in the browser instead of traditional web programming in which developers need to jump from one screen to another.

Fortunately, internet browsers are becoming more powerful and can process JavaScript faster than ever before, which has led to JavaScript applications becoming even more popular. Ajax and JavaScript provide a powerful user interface, but these applications also need to ensure that data will be displayed. This is done using Representational State Transfer (REST), often called restful programming. REST is flexible and powerful and has emerged as the predominant web API design model. Software programs written using this complex approach are becoming known as Rich Internet Applications (RIA).

Moreover, with the growing use of cloud storage, REST API has become the most popular interface for data access and management used by software developers specializing in web application development. In fact, companies like Twitter, Facebook, and Dropbox use REST APIs to access their services. REST APIs provide programmable access to storage and are uniquely language independent, making it possible to deliver file and object management services far beyond what is offered by traditional storage interfaces. A REST Server is a web application, and it can be developed using several technologies (Java,php,.net). In our case we develop using java and build the rest of the server in a war file.

If the REST Server is provisioned outside the company, consequently, the RIA app would be required to connect to a remote server (for example, a RIA app that connects to a weather server). Many companies are required to maintain a separation of duties, in which workers must meet audit and federally mandated regulatory requirements. In this case, the REST server has to be deployed by a trained and authorized release engineer.

Now let's consider how we organize the code. JavaScript code is difficult to debug and organize properly, so to solve this problem, we can use frameworks like Backbone Js. Backbone is a Model Viewer Controller (MVC) framework that allows the developer to create RIA Applications separated into a layer model. To operate this Backbone, use Views, Models, and Router objects. The Backbone View represents the view of the layer model and is used to load a template and then render this template to show data to the users.

The Backbone Model contains the interactive data as well as a part of the logic when a model is modified to fire an event. This event modifies the view. Let's consider the backbone router next. The BackBone Router contains the logic that chooses what actions are executed. There are a variety of frameworks that can help display the information properly including Dojo, Sencha, and JQuery. I prefer JQuery because it is the most widely used. JQuery can also work with Backbone and provide widgets and components that allow the developer to show the information to the client in a user-friendly way.

RIA applications are often used to store important data in the browser that must be protected. The best way to approach security is to use chryptographic JavaScript libraries that can help encrypt data for the client safely. One such tool is known as the Stanford JavaScript Crypto Library, and it is very effective at protecting your data.

Keep in mind that this powerful technology requires browsers that can work with JavaScript and Ajax; unfortunately, not all browsers can support RIA applications. This is a small price to pay for the power and convenience of a rich interface, although you may need to be involved with ensuring that users have a browser that can support this technology with all of its benefits and features.

RIA applications also enjoy much better performance than traditional web programming that must send HTML every time the user requests a new action. RIA also sends data in JavaScript Object Notation (JSON), which is a text-based open standard designed for human-readable data interchange. JSON is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. JSON is fast, and despite its relationship to JavaScript, it is language-independent, with parsers available for many languages.

RIA app is just a bundle of JavaScript and HTML files, and it could be deployed in a server as a static web application. Ant provides an ideal tool to automate the application build, package, and deployment.

As you have learned, there is a considerable amount of complexity in this technology. Now you have some idea of how this technology works, and I hope this helps you understand it a little bit better the next time that you are asked to build and deploy a RIA application based upon JavaScript, Ajax, and Backbone. Welcome to the collaboration between development and operations (DevOps)!

About the author

CMCrossroads is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.