13 July 2010
All
The need for data-centric development tools has increased with the growing popularity of rich Internet applications (RIAs) and Service-Oriented Architecture (SOA). RIAs offer a rich, engaging experience that improves user satisfaction and increases productivity. SOA, being the natural architectural choice for web application development, is increasingly being used to expose data via services. These two trends have led to a stronger focus on consuming software as a service in the development of RIAs.
One challenge in building data-centric RIAs is the need to consume different kinds of services (RESTful services, web services, and so on) with heterogeneous data formats (including XML, JSON, and AMF) in a uniform way. To manage this challenge, developers need tools capable of creating a technology-agnostic data model, and they need a way to bind this model to the application user interface.
This article outlines a service-centric approach that applies a service-based model definition methodology to work with disparate services as well as a model-centric approach to define a common application data model across clients and servers. It also covers a model-driven user interface authoring approach for building powerful data-centric RIAs using the industry leading Adobe Flash Platform. Challenges related to data synchronization, conflicts, and on-demand data access are also addressed.
In the early days of Internet computing, application interfaces were mostly text based and the main development challenges centered on handling the volume of data traffic and diversity of services. Advances in SOA helped pave the way for new software delivery models over the web. The need for providing better user experiences became amplified with software as a service (SaaS) becoming a mainstream, proven methodology for delivering complex software products. RIAs provide that improved user experience by combining the reach of the web with rich, interactive user interfaces. Rich refers to the ability to incorporate client side interactivity and intuitive user interfaces resulting in engaging experiences, whereas reach is the ability to make an application available to almost anyone, anywhere. Technology advancements along with concepts such as social networks are fueling many of the so called “Web 2.0” applications in which data, exposed through services, is considered to be the central element. In RIAs, local computing power is used for rendering user interfaces, integrating video and animations, or even offline data analysis.
An RIA platform is an integrated set of technologies meant for designers, developers, and consumers that provides everything needed to create and deliver compelling applications (see Figure 1). The following are the key expectations of an RIA platform:
Because organizations have already invested in building service-oriented architectures, one of the key challenges that RIA developers face is the need to integrate with existing server-side technologies such as J2EE, ColdFusion, PHP, or web services. To this end, they need to be able to work in a seamless way with both client and server code within an Integrated Development Environment (IDE). Further, the IDE should provide design time facilities that abstract diverse services and data formats by using technology-agnostic representation of the service operations and data.
XML and JSON are less efficient for exchanging large volumes of data. As a result developers often use binary formats such as Action Message Format (AMF) for such situations. Services that are exposed over AMF can be developed in different languages, including object-oriented (Java) and script-oriented (PHP) languages. RIA developers need a uniform way of working with these AMF services, similar to how Web Service Definition Language (WSDL) has provided a uniform way of working with various web services. There is also a need for the IDE to help the RIA developer author user interfaces by leveraging technology-agnostic data representations to help boost developer productivity.
The Adobe Flash Platform (see Figure 2) includes the following products and technologies:
Designer tools, client-side RIA development tools, and server-side development tools form the foundation for creating rich web applications (see Figure 3). When creating expressive, data-centric RIAs, there is a sweet spot for tooling in which the tools integrate well with each other and enable necessary workflows for the designer, client-side developer, and server-side developer to work seamlessly.
The diverse ways of authoring services and disparate data formats have resulted in the so called service hell phenomenon, which presents unique challenges for the client developers working with them. This section presents three approaches for working with these services: service-centric development, model-driven development, and contract-centric development. It also covers how these approaches leverage the data communication infrastructure to solve challenges related to data synchronization and management. All three approaches enable developers to invoke services in a uniform way, access service responses in an object oriented way, author user interfaces, and manage data communication. This is achieved through a format- and technology-agnostic model called the Adobe Data Model.
The Adobe Data Model enables developers to define data entities, the relationships between those entities, and abstract services responsible for delivering the entities to data clients in an XML-based language (see Figure 4). In addition to entities and services, definitions found in a model include styles, (which bundle user interface related information with data types) and annotations, (which enable specific consumers to add domain specific information to a model).
A service represents a set of operations providing a certain functionality. For example, a WSDL document represents a service exposed over the SOAP protocol. Service-centric development is an approach in which the client-side developer works with already defined services to build data-centric RIAs. This approach has three main building blocks (see Figure 5):
There are three main components to service definition:
In service analysis sample data is introspected after it is obtained from one or more providers that will be queried by the application under development at runtime. The sampling results can be used to provide hints or suggestions at development time so that a developer has the proper context to reference the data. When the sampling results comprise many parameters, the developer can indicate custom type declarations for the returned parameters or identify a subset of the parameters returned by a query as being of interest, which can then be used to facilitate more meaningful hinting or suggestion by the tool.
This process starts with querying the data source using the data source interface (see Figure 6). The data introspection process comprises receiving a data sample returned by the data source in response to the service operation, characterizing the returned data, and storing one or more characterizations of the data in a object-oriented way for later use by the code authoring, hinting, and user interface authoring modules of the tool. Characterizing the data can be done by identifying the underlying data types and structures directly from the protocol or through the sample data. For instance, the returned data may be "strongly typed" when using the AMF protocol. In other cases, the data may be "weakly typed," (such as when using XML or JSON data) but then "strongly typed by the developer" using the tool. The tool can support characterizing data without the use of strong types, however, independent of whether the data is strongly typed at the source.
Characterizing the returned data also includes inferring a data structure definition for the returned data. For example, the data returned by the query may have an underlying tree structure. A data structure definition for the returned data may be inferred by using heuristics based on the format of the returned data. Thus, characterizing returned data can include determining a data parameter's relative location in a data structure. As an example, nested objects may be recognized through analyzing the structure of a returned XML document. In some service responses, characterizing the returned data requires identifying a subset of the returned data structure as being of interest based on user input. Continuing with the example of data parameters organized into a tree, a developer may indicate that only a certain subset (or subsets) of the tree is of interest, analogous to using XPath to address specific XML data elements. This preference is stored by the tool and can be used to provide hints to the developer.
Data introspection forms the basis of the service's entities and operations and generates the model.
As an example, consider a call to a service that provides the temperature at a particular location from a weather service. In the sample code, the HTTPService tag has a URL and an operation to get the weather data. Below there is a text box with a data binding (indicated by curly brackets) to a particular data item from the query.
<mx:HTTPService id=“weatherService”
url=“http://weatherservice.example/weather”>
<mx:operation name=“GetWeather”/>
<mx:HTTPService/>
<mx:TextArea id="temp" text="The current temperature is
{WeatherService.GetWeather.result.CurrentTemp}" />
From the data introspection module, the developer can actually invoke the GetWeather operation, identify the response as a Weather custom type, and reference the result as that type during development. The developer can reference the currentTemp data item as a property of the Weather custom type using code hinting and can bind that to a component in the user interface authoring module as described in the next section. This process eliminates many of the difficulties that crop up when working with weak data.
The process of model-based user interface authoring involves two elements:
Code generators form an important building block in user interface authoring. With the growing diversity in services and the disparate data formats, code generators in the developer tool help the developer by:
Model-driven development is a mature development process and has been part of software engineering for quite some time. Model-driven development for creating data-centric RIAs is becoming a key trend as it addresses the challenges related to diverse services and formats by providing a layer of abstraction via the model. Model-driven development differs from service-centric development in that the developer starts with a model rather than with a service. Therefore the developer is in control of the data properties and service operations. The following are the key elements of the model driven development life cycle:
Adobe Flash Builder and Adobe LiveCycle Data Services provide a comprehensive set of tools for developing RIAs based on model-driven development.
The process of contract-centric development addresses challenges such as frequently changing interfaces and data formats from one or more service providers. It also accelerates the development of data-centric RIAs when there are different teams working on the client side and the server side independently and in parallel. The following contracts are required for RIA development:
Classical approaches require contracts to be finalized before development starts among client and server developers. However, there are alternate approaches in which client-side developers start with initial contracts and add their own definitions to the contract that are exchanged with the server-side developers during development. Examples include adding new operations or entities on the client, which can be implemented later by the server-side developer.
Adobe Flash Builder supports contract-centric development. Developers can generate models from XML and JSON contracts and work with frequently changing contracts. Further, such contracts can be easily replaced with actual services once they are available.
Data-centric RIAs invariably need to process data, cache data, execute business logic on the client side, and update data on the server. The messaging and data synchronization libraries form the backbone of communication in an RIA (see Figure 7).
For occasionally connected RIAs data synchronization is paramount. Such RIAs need mechanisms to automatically store data in a local cache when the user is offline and synchronize the data with the server when online. The RIA development platform, as part of this process, should provide tools to enable this data synchronization and provide developers with mechanisms to handle data conflicts during synchronization.
Data management is another key requirement and includes paging, automatic data persistence, and keeping track of the creation, update, and deletion of objects on the client side.
Many RIAs also require exceptionally reliable communication with the server. Such applications include:
Client-side data management libraries (see Figure 8) help the RIA developer by providing:
The increased complexity of data communication as highlighted in the previous section coupled with disparate data formats fuels a need for deeper analysis of data communication during the development life cycle of an RIA.
In RIA development, developers encounter the following problems:
The solution to all of these is a network monitor, provided by the RIA development tool, that the developer can use during development for deeper analysis of the RIA application. The network monitor intercepts communication from the application and reports the results. Traditional network sniffing tools provide information on the data traffic, but fall behind in identifying the code that is causing issues. The Flash Builder Network Monitor provides the mapping of source code to data traffic captured, which helps developers easily identify the root cause of problems.
Data-centric RIA development comes with a unique set of challenges. This article has presented several approaches and technologies that take advantage of a format-agnostic data model. The approaches presented use innovative ways to construct the application, including model-based user interface authoring, code generators that accelerate application development, and client-side data management, which makes it easy for RIA developers to handle data synchronization, automatic data persistence, paging, and on-demand data access. RIA application development has spurred tool innovation in all the three axes of development: design, client-side development, and server-side development.
In the future, these tools are expected to converge further towards the sweet spot of data-centric RIA development tools by providing features like seamless client-server data debugging and round trip engineering of designer-developer artifacts between tools. The Adobe Flash Platform provides mechanisms and state-of-the-art tools that take RIA application development to the next level.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License