XForms for Web Applications

Steven Pemberton, CWI, Amsterdam and W3C
Chair, W3C HTML and Forms Working Groups

XForms 1.0: en route to success!

XForms 1.0 was released October 2003. On the day of release there were more implementations than any other W3C specification on the day of release, ever.

Around 30 implementations announced so far, including plugins, native implementations, proxies, 'zero install' implementations, a voice-browser, an editor, a validator...

From companies such as: IBM, Novell, Oracle, Sun, xport.net, ...

Major companies and industries are already using XForms (e.g. US Navy, Bristol-Myers-Squibb, Frauenhofer, Daiwa - a Japanese Bank, the British Life Insurance industry, German shipbuilders ... and more I can't tell you about yet: watch this space!)

The Central Ideas of XForms

The central ideas of XForms are that:UI/Model split

Not Just for Forms

Although XForms comes from an analysis of, and as a replacement for, HTML Forms, it is more, and can be, and is, used for applications as well.

It has:

Memory model

The data is one or more XML documents, internal or external.

Input, output, data properties, calculations 'bind' to elements and attributes in the data

Memory can be initialised inline, from a file, a URL, a query, SOAP, etc, etc.

Input/output

Controls are deliberately abstract, only expressing intent (such as select one from a set). Presentation is up to the implementation, stylesheets, binding to SVG etc.

Abstract level ensures device independence and accessibility

Fallback ensures applicability over a wide range of device types.

There have already been demonstrations of the same XForms being served to a PC, a PDA, a cell phone, a voice browser and even an instant messenger, without change.

Calculation

XForms has an extensible, declarative calculation model, like spreadsheets

Uses XML Events, with primitives that mean scripting is often not necessary

Scripting still an option

Imperative vs declarative

4 clocks running on a purely declarative systemIn the 80's I built a completely declarative system.
It ran on an Atari ST amongst others.
Here is a screen shot (on Unix) of several clocks in that system.
They are all ticking every second.

Imperative

To write an analogue clock takes a lot of code. Here is the shortest I could find: more than 1000 lines.

The C code for an analogue clock: more than 1000 lines

Declarative code for a clock

clock = (h, m, s)
s = system:seconds mod 60
m = (system:seconds div 60) mod 60
h = (system:second div 3600) mod 24
aclock = circle(combine{hhand, mhand, shand,
                        decoration})
shand = line(slength) rotated (s*6)
mhand = line(mlength) rotated (m*6)
hhand = line(hlength)
          rotated ((h mod 12)*30 + m div 2)
hlength = ...
mlength = ... 
slength = ... 
decoration = ...

Presentation

XForms can be hosted in different languages

Use CSS for presentation

Or binding to SVG

etc

Advantages