Introduction - rich user interaction patterns and platforms

Web users today seek ever increasing interactivity and responsiveness in Web applications, particularly as those applications expand in scope and function to provide increasing levels of capability ("richness') in presentation, control, and data management. The drive for richness stems from a desire for authors to address greater functional goals in their applications -- moving from web content to commerce to collaborative services. The means for achieving richness stem largely from migrating function back to the client that historically has been resident on the server -- we do not seek to re-establish a world of client-server computing but rather to increasingly leverage client capabilities in an era of greatly expanded distributed computing and online services.

The Rich Web Application Backplane Incubator Group (XG) has had as its goal understanding, demonstrating, and documenting two areas of work: (1) authoring patterns for increased client-side capabilities in not only rich presentation or graphics but also in navigation control and data capture and validation for high-function web applications, and (2) techniques for extending current browser runtimes to support these authoring patterns across a variety of markup formats beyond the varients of HTML supported "natively" by existing browsers.

In this XG report, be begin in the first section by presenting an example scenario and application focused on expense tracking. This application will be used in the following section to to illustrate the manner in which a variety of markup formats including XHTML, SVG, XForms, SMIL, and other emerging formats such as the Open Document Format (ODF) come together in a coherent working whole. In section two, we illustrate a set of relevant authoring patterns for similar high function extensible web applications, including a separation of concerns between data and presentation and corresponding single and multiple node data binding, an approach to loose coupling between separately authored components using XML events, coordination of client-side state across the page using shared and transformed data models, and computed metadata over that client-side state to drive UI behavior such as conditional display of content and conditional triggering of control flow. In many cases, these patterns may already be supported today in several of the formats used in the example scenario. In other cases, we identify extensions to those vocubularies where increased function or simplified authoring could be possible.

In section three, we go behind these application patterns to describe their implementation in current browser platforms. We have come to focus on this point significantly in the XG's work since we believe that in the evolution of the web today it is not sufficient only to propose improved formats without corresponding emphasis on pragmatic routes to adoption. Indeed, in many cases the patterns we describe have been known for some time but have not reached critical mass in the developer community due to lack of convenient runtime support rather than lack of consensus as to their utility. We are excited at this point as to the potential for greater cross-format adoption of concepts such as MVC data binding, event-based coordination, implicit creation of the UI through repeats over queries on the active client data, and so on pricisely since we now see and are actively involved in the creation of practical, performant, and deployable techniques for their use in current browser technologies.

Example: Introducing the Expense Tracking Application

End-user experience supported by the scenario

Figure 1 is the main page of a simple expense tracking web application that we will use to illustrate authoring patterns and runtime integration of multiple markup formats. A list of expenses can be entered with a category, description, date, and amount for each. Expenses are stored in an XForms data model bound to this list. The list is coordinated with an entry area which provides extended editing controls in a master-detail relationship with the expense list. Once created, expense entries may be edited in place using the UI controls in the master list. Entries may be deleted by clicking on the "X" at the right of each record.

Figure 2 shows a graphical view of expenses aggregated by category and drawn using an SVG piechart. The expense categories included in the piechart are determined dynamically by a data-driven aggregation of all non-zero categories from the underlying expense list as described and illustrated in markup in the next section. Figure 3 similarly shows a projection of expense entries by date again using SVG.

A set of expenses, once entered, may be submitted for re-imbursement by a report-generation tab implemented using the Open Document Format (ODF) text format as shown in Figure 4. Open Document text (ODT) elements are used to define a template for expense reimbursement with the actual expense document containing only those categories with non-zero expenses. ODF documents in the OASIS 1.0 specification may include XForms data models. As shown in Figure 4 we use this capability to bind the expense report directly to data in the underlying expense tracker's data model. Further, the table of contents entries are computed dynamically based again on those expense categories having non-zero entries and thus needing to appear in the running document. Of particular note in this example is this enablement of ODF as a web-centric markup format participating directly in the overall page lifecycle with other web formats such as XHTML, XForms, and SVG.

Schedules permitting, our goal with this scenario has been to augment it with time-based controller logic implemented using SMIL 3.0 markup running in the browser. Section X, below, describes an AJAX implementation of SMIL following the same platform extension mechanisms as used for XForms, XML Events, and ODF elsewhere in this scenario. We describe below the use of this library in a separate demo of an interactive tour of cities including New York and Amsterdam [cite]. In the detailed discussion of the authoring and runtime behavior of our finance example in the following section, however, we outline our current thoughts as to the use of SMIL as a general controller for web applications having some element of time-based behavior -- and how this might be applied to the expense tracking scenario.

Scenario as illustration of infrastructure requirements

While Section 4, below, treats the implementation of each format used in our expense tracking example in detail, we provide first a roadmap to understanding the document structure and runtime behavior of this example.

Figure X shows a cut-away view of the "stack" of a running document. The base browser provides core HTML and XHTML parsing capabilities along with required styling (CSS) and network support as usual. Pages are authored using standards-compliant formats (XHTML, SVG, XForms, XML Events, SMIL, ODF) and delivered to the browser directly. In contrast to other approaches to browser extension we do not view these markups as authoring-time only formats but rather support them directly in the browser by attaching their executable "behaviors" to the original source document elements as shown in the figure. The technique used for this behavioral "decoration" varies by browser (see the discussion below in Section X) but such differences are localized to page loading time and are not visible to page authors as they continue to see a common document structure consistent with its originally authored structure (view source is what is running not transcoded into HTML) and consistent behavior in all browsers supported by this library (currently Internet Explorer 7, FireFox 3, and the Safari/Chrome WebKit-based rendering engines).

Indeed, we see this approach to using Javascript as an important implementation technique for extensible markup elements whether they are XML or HTML-based. The examples we have given are from XML vocabularies (others may include State Chart XML -- SCXML, and ...) but a script-based "tag library" mechanism would be interesting for supporting incremental modules of HTML5, for example, as they appear in working drafts or perhaps separable Recommendations -- and also as a means to accelerate their implementation and adoption in a broad developer community before "native" implementations in each browser are fully available.

It's also important to track emerging markup formats from sources other than the W3C and ask whether they might be of interest as components of web-based applications. Our example shows one such format, from OASIS -- the ODT text format used for expense reimbursement. There are potentially other emerging formats, particularly in the space of industry vertical standards, which may similarly be of interest for use client-side with first-class implementation of their behaviors. Examples might include HL7 and Clinical Document Architecture (CDA) from the healthcare industry, ACORD from insurance, and XBRL from the finance industry. These formats are of potential interest not just as data-exchange formats but to the extent they have interactive behaviors also as components of client-side web applications.

Application patterns supporting RIAs

In this section we present authoring patterns which are independent of the particular markup format in which they are used and which provide common approaches to data management, mapping of data to abstract and concrete presentation, and interaction control. These patterns form the essentials of what we have come to call the rich web "backplane" in that they provide a structural underpinning to a client-side web document independent of the particular content type being presented, facilitate the separation of concerns such as data vs. presentation vs. control, and hence provide a common skeleton -- aka backplane -- assiting in the composition of more complex web applications from a collaborating set of more primitive components.

While there are many widget or other component architectures emerging some of which [cite iWidget] also facilitate cross-component data sharing and communication, these approaches are coarser-grained units of composition than what we describe. The patterns which follow are embedded directly into the behavior of individual elements and groups of elements of their host languages and hence we view them as inherently integrated in those vocabularies rather than layered on top.

Transparant composition -- event based patterns

We begin with a simple observation as to the importance of transparent control within web pages. By "transparent" we mean the ability for one component in a page to observe, participate, and potentially alter the execution of another component in the page. This capability is desirable for authors adding function to an existing page, e.g. in "mashing up" content, in that it allows for their incremental content not only to provide additional presentation but also to augment the interactive behavior of the page in previously unanticipated (by the original author) ways.

The principle means for observing and augmenting control is through a consistent adoption of an event-based pattern of cross-component control rather than direct invocation of methods or procedures within a page. Direct invocation, while commonly used and simple to author, results in hidden paths of control which can not be observed or intercepted by code elsewhere on the page.

An event-based pattern, on the other hand, begins with a signaling phase in which external observers are notified as to the impending execution of the "default action" of the event. Handlers called at either capture or bubbling phases may inject additional logic to prepare for or as a consequence of the default action. Figure x illustrates the behavior of the XForms trigger element as an example event-based execution pattern. In this example, the setvalue action is executed not due to any "private" contract between the parent trigger element and its children but rather as a result of "publically" handling the DOMActivate event dispatched by the trigger on itself as a result of user interaction. According to this pattern, other event handlers not nested syntactically within the trigger context and potentially provided by independent authors, participate as first-class handlers in the processing of the trigger lifecycle.

        <xf:trigger>
           <xf:setvalue ev:event="DOMActivate" ref="target_node">new value</xf:setvalue>
        </xf:trigger>
        

For those events which are cancelable, handlers may suppress the default action perhaps replacing it with logic of their own. A familiar example is the default action of selecting an anchor tag is to traverse the link. Canceling that event does not stop its propagation to notify other handlers, but does prevent traversal of the link at the end of the bubble phase.

One can think of this pattern as a partial "aspect oriented" programming within web pages where event propagation prior to the default action provides hooks for injecting code at various points in the event lifecycle. The potential utility of a secondary capture/bubble phase following default action execution (completing the analogy with AOP) probably lacks sufficient use cases to balance the increased expense of additional event propagation.

From a "backplane" perspective, the importance of this discussion is not due to the novelty of event-based patterns. Indeed, web authors are quite familiar with adding handlers to click, onload, and other HTML-related page events. Rather, since extensibility through the creation of new elements rather than script-based code has not been the norm to date on the web we don't see authors readily creating custom elements and hence extending their pages with custom events conforming to a transparent event-based pattern. Providing a well-defined means for declarative extension of web pages may provide the corresponding incentive to adopt more aspect-like patterns of composition as well.

Patterns for client-side rich data management

Moving additional data and its associated calculation, transformation, and validation to the client is a key feature of rich web applications. Often, however, this aspect of interactivity is overlooked in comparison to the rich presentational impact of raster or vector graphics or video in adding dynamic behavior to client-side web documents. This section focuses therefore on various patterns which add "data rich" behavior to web applications in a manner we see as applying horizontally to an increasing number of web formats.

Data transformations within the model

The XForms data model is well described elsewhere [cite XForms 1.1] and we do not repeat that discussion here. Rather, we focus on the emerging use of that format beyond conventional "forms" applications for data maangement in web applications and indeed beyond that context to formats such as Open Document not traditionally thought of as web document markups. Again from a "backplane" perspective, it is clear to us that the ability to store "instances" of data (whether XML or otherwise), to validate that data, compute over it to derive related data, and to associate metadata indicating the validity, relevance, and required states of that data are features of not only forms, but of rich web applications generally and also of rich document applications based for example on ODF [cite ODF]. We begin by reviewing briefly the use of XForms data in the expense tracking example, focusing on data transformations to support multiple alternative views and metadata to support conditional presentation and formatting of those views. We then look at binding notations for projecting data into other layers of the web document, whether views or control, and how the binding attributes and their behavior can be applied horizontally to multiple host languages.

Data transformations, declarative and procedural (with event-based trigger)

MIPs

Single node data binding

Nodeset binding

Extension with new presentation or content formats

Separation of data, abstract presentation, concrete presentation

Custom controls from AJAX libraries

SVG as a format for custom controls

Examples in ODF (current and proposed)

Extension with new controller formats

SMIL

SCXML

Overview of approaches to language extensibility

Server-side transcoding

Client-side transcoding, e.g. dojo.E, "Ample" sdk (www.amplesdk.com)

Progressive enhancement and unobtrusive javascript, e.g. Dojo

XBL

Cross-platform client-side behaviors, e.g. Ubiquity-xforms

Requirements for standardization

Appendix: Implementation of formats used in the financial services application

XForms and XML Events

SMIL

Open Document Format Text (ODT)

Other possibilities: SCXML, Acord, HL7 -- many have behaviors not just data formats.

HTML and its extensions through HTML5/6/custom modules