XForms, REST, XQuery...and skimming
Mark Birbeck
Building web apps today
The client is too thin, so all the work is done on the server:
- Querying one or more databases...
- ...building forms for the user interface...
- ...maintaining state...
- ...and validating data.
Building web apps today
No complete separation of
UI and data
Applications generally get some data and use it to create a UI:
- Java classes generated from XML;
- HTML
select is created from a recordset.
This means that it's difficult to break UI from the data:
- difficult to use the same data with a different UI;
- difficult to use the same UI with different data.
No complete separation of
UI and data (2)
The kinds of problems this causes:
- URLs invariably point to a UI that acts on some data,
and not the data itself;
- an application that runs remotely is different to one that
runs locally;
and so on.
No complete separation of
UI and data (3)
We want the data to be passed to the UI, not used to generate it.
Hence the idea of 'skimming'...like a stone bouncing across a lake.
The fundamental role of web services
Advantages:
- distributed -- use internet protocols;
- easier to maintain;
- gives us a standard interface to data (could call it ODBC for the web);
- creates possibility of really keeping data independent of the UI;
- it's the foundation for a new type of internet application.
And by web services we don't just mean SOAP, but ATOM, REST, RSS, and so on.
Building web apps with web services
Summary of web services
Advantages over conventional model:
- allows data to be relocated;
- standard interfaces to data.
But:
Rich client approach
More control to client allows data to become completely independent of UI.
Applications become much easier to author since
we can have a clear distinction between:
- forms designers;
- help text authors;
- database builders;
- translaters;
and so on.
Building web apps with rich clients
The role of XForms:
Distributed applications
A standard language for defining truly distributed applications:
- Data for help, hints, labels, etc., from one source...
- ...for selection lists from another...
- ...data to edit from another...
- ...and posted to another!
Yet the deployment model for XForms is what we would expect from 'thin client'.
The role of XForms:
Dynamic UI
UI automatically updates when data changes, with no round trips:
- repeating data structures;
- many controls bound to the same data.
Data type can drive UI (e.g., dates and booleans):
- add
xsi:type to instance data;
- link to an XML Schema;
- use
xf:bind.
A simple XForms application
Demo showing different sources of data for labels on controls and in drop-boxes, as well as dynamic update
of repeating data structures and controls based on data type.
Summary on rich clients
Separate data from UI with web services...rich clients make this a reality.
XForms is an ideal rich client:
- distributed data sources;
- dynamic UI;
- declarative;
- XML standards-based (schema validation, XPath, XML Events, etc.);
- event driven;
- multi-platform;
- accessible.
Improving on web services
XForms standardises on the UI...
...but with WebDAV, ATOM and XQuery we can standardise the server.
Recap on the model we're working towards
WebDAV and ATOM
Use WebDAV and/or ATOM to manage the database:
- insert and delete from any client;
- no more managing of tables and schemas;
- works 'out of the box', e.g., eXist and GData.
Demo showing oXygen adding and removing items, without the need to update schemas, etc.
XQuery
Use a standard language to query data:
- hides the specific database;
- gives control to the client.
The future
GData uses ATOM...which means we can 'program against the cloud'.
Demo showing how to query GData using ATOM, and then update a spreadsheet with data that becomes a pin on a map.
Conclusion
skimming depends on:
- a rich client, such as XForms;
- web services that can manage data, such as WebDAV and ATOM;
- web services that can query data, such as XQuery and SPARQL.
Together they allow us to produce flexible web applications that are easier
to maintain than traditional applications.