Wednesday, October 29, 2008

Services for RIA

Last week I presented a session at AJAXWorld 2008 in San Jose, titled “Hands On Data Services for RIA, WOA, and SOA”. While the “hands on” part was a demonstration of the XAware technology, where I showed building a data mashup from text data logically linked to a database, the first half of the presentation was a discussion about the key role of data services in Rich Internet Applications (RIA), Web Oriented Architecture (WOA), and Service Oriented Architecture (SOA). Data is almost always at the heart of an application, thus finding appropriate ways to get data to an application is a key part of making a software system work. Since I was at AJAXWorld, where RIA was all the buzz, I focused the importance of data service in an RIA environment.

The idea of using a services layer to supply information and operations to a web client application is not new. While I’ve written about the combination, I certainly am not the first to recognize the nice fit. Some of the acronyms floating around the internet, and the AJAXWorld conference were SOFEA (Service Oriented Front End Architecture) and SOUI (Service Oriented User Interface). SOFEA was coined by Ganesh Pradad and a couple coworkers in October, 2007, in a paper titled “Life Above the Service Tier” (http://sofea.googlegroups.com/web/Life+above+the+Service+Tier+v1_1.pdf). Ganesh’s blog (http://wisdomofganesh.blogspot.com/), which is high on my favorites list, contains additional information and resources.




SOFEA recommends a clear separation of presentation tier concerns. The major processes involved in the presentation tier are:

1. Application Download phase
2. Presentation Flow – driven by client side
3. Data Integration – use the service tier, peer-to-peer (allowing two way communication like notifications). XML based using REST or WS-*.

By separating these concerns, each can be optimized for its special needs. Whereas traditional thin-client technology requires the server to be involved in all three concerns, the rich capabilities of RIA no longer require that. In addition, the data integration piece can take advantage of an existing services layer, that is likely already built or under construction within the enterprise. Ganesh also claims that the Front Controller pattern, used in all the server-based web development frameworks, is actually an anti-pattern, made popular simply because of the previous lack of capabilities on the client side. The existence of so many frameworks supports his point, as none of them seem to quite satisfy the needs of the presentation layer. They never will, according to Ganesh, because, among other things, placing portions of the presentation flow logic on the server violates the principle of separation of concerns. Encapsulating presentation flow fully on the client side is now possible with the quickly maturing RIA development environments.

SOUI shares a very similar architecture. Proposed by Nolan Wright and Jeff Haynie (who founded Appcelerator on this principle), SOUI also places presentation flow logic on the client side. The major difference between SOUI and SOFEA is the preference for JSON in SOUI. JSON is more compact than XML. But the advantage of XML is the better typing system (elements and attributes can be strongly typed), along with validation tools built in.

The XAware project appears to be a very viable candidate to fill the gap of the data integration piece within SOFEA and SOUI. The environment is well-positioned to create information-rich services to supply data to the presentation tier. As we continue with project development, we will be adding more support material and features to make it even easier to use XAware for RIA development.

RIA at AJAXWorld 2008

I attended AJAXWorld 2008 in San Jose last week, where I sat in many sessions and also presented a session myself. It was a good and interesting show, focused mainly on Rich Internet Application (RIA) development technologies. While my day job usually has me dealing with back-end server, data integration, and data services issues, it was a refreshing change of pace to look at what is happening on the user-facing side. I’ve always had a thirst for building user-facing applications, and as you would expect, the attendees as a whole share that sentiment. Paraphrasing the words of Jeremy Grelle of SpringSource, one of the beautiful things about user interface development is the immediate, visual feedback you get during the development cycle. You make a change, hit refresh on the browser, and voila, you see your change. I’d like to share just a couple tidbits I picked up at various sessions:

Jeremy Chone of Nexaweb, pointed out the different target markets for UI development, the consumer market (think Google.com, Yahoo.com, MySpace.com), and the corporate market whose users are employees of a company. The consumer market demands the most polished and engaging experience, because users are surfing on their own time, and generally pick the site that’s most enjoyable to visit. The corporate environment, on the other hand, focuses on productivity. Users want to get their job done quickly and efficiently, so they can go home on time after a successful workday. Consumer apps must scale in terms of users. Companies must scale in terms of the number of applications that will help automate business processes. Business agility is important here, where new features and new applications can be built quickly. See http://www.jeremychone.com/ for more information about Jeremy and his blog.

Jeremy Grelle of SpringSource talked about the many Spring projects supporting Rich Internet Applications. Spring hopes to augment the popular AJAX and RIA environments like JQuery, YUI, Dojo, and Ext, but also has projects in the works with competing technologies. Jeremy emphasized that balance must be achieved between client side and server side processing.

The balanced approach that Jeremy talked about seems less pure than another theme I saw in several sessions, that RIA should exploit client processing to the greatest extent possible. In particular, Michael Galpin’s presentation on Networked Application Architecture (his blog at http://fupeg.blogspot.com/) noted the migration of RIA processing responsibilities towards the client. Whereas the 2003 view of RIA was that client and server shared presentation logic responsibilities, the preferred architecture is to place all the presentation logic on the client. This exploits the massive increase in client computing power over the last few years, while reducing server burden. We now get this power for free. Michael canvassed some of the most popular RIA environments, like Flex, Google Web Toolkit, Silverlight, and JavaFX. He currently favors the technology of Flex, with its 97% browser penetration, but he sees good improvements in the competition and vendors try to leapfrog one another. Michael also mentioned a couple acronyms to watch out for as emerging impact makers – SOUI (Service Oriented User Interface) and SOFEA (Service Oriented Front End Architecture). I’m working on separate blog article on these, as both use an architecture near and dear to my heart – using services to supply the information to the client application.

Douglas Crockford, most recently famous as the “discoverer of JSON”, gave an interesting presentation on JavaScript (ECMAScript, officially), its strengths and weaknesses. The primary strengths are support of dynamic objects, the lambda property of functions (a function is an object that can be created on the fly, and passed as a parameter), and the loose typing that eliminates casting in most cases. JavaScript does have its shortcomings, but they are not that plentiful. The real problem, Douglas says, is that JavaScript is so easy on the surface, that developers rarely take the time to really learn it in depth. As a result, he calls JavaScript the world’s most misunderstood language, and highly recommends that developers take the time to learn it, as they will be pleasantly surprised. Douglas created a tool, JSLint, a program checker that he feels helps define a “professional subset” of JavaScript that will help developers avoid the few non-obvious pitfalls of the language. For more information about Douglas and his prodigious contributions to the software world, see http://www.crockford.com/.

I also attended a session on Google APIs focusing on RIA support. Google has been a leader in exposing Google features through an API, encouraging early experimentation in visual mashups and client applications. The Google Web Toolkit (GWT) is Google’s development environment for RIA. It is unique in its approach in that a developer writes code in Java, calling APIs as necessary. Then the client application retrieves components in the form of JavaScript, which is actually compiled on the fly from the original Java. A GWT bootstrap module determines the browser type and version, so that the conversion to JavaScript is optimized for that specific environment.

This is just a sampling of the sessions I attended, but does represent the most interesting of the bunch, at least in my mind.