ajax

Understanding the XForms dependency engine

A key component of any XForms processor is the dependency-engine. The idea is pretty straightforward, and will be familiar to anyone who has used a spreadsheet; if some item has its value set by a calculated expression that contains references to other items, then when any of those items change, the first item must be recalculated.

Read more in my introductory article on the XForms Developer Zone site, Understanding the XForms dependency-engine.

XForms Developer Zone and User Group launched

We're pleased to be launching two new initiatives to help people who are interested in XForms.

The first is the all new XForms Developer Zone web-site -- or xformsdz, as we're calling it.

Whilst the Developer Zone will be unashamedly biased towards XForms, within that, we'll have discussions, articles, code snippets, and tutorials about any XForms processor we can find, and any application framework in which it's used.

To accompany the web-site, we're also launching a regular newsletter, and a London XForms User Group.

Read more at XForms Developer Zone and User Group launched on my webBackplane blog.

Duck-typing and XForms

In a recent code review on the Ubiquity XForms project, the question of whether to test for an element by name or properties came up. In this post we look at the benefits that can be had from using duck-typing as a way to manage objects' functionality, rather than the more usual hierarchical solutions.

Read more in Duck-typing and XForms, on my webBackplane blog.

XML 2008 liveblog: Ubiquity XForms

I will talk about one or more sessions from XML 2008 here.
Mark Birbeck of Web Backplane talking about Ubiquity XForms.
Browsers are slow to adopt new standards. Ajax libraries have attempted to work around this. Lots of experimentation which is both good and bad, but at least has legitimzed extensions to browsers. JavaScript is the assembly [...]

FormFaces.com

FormFaces.com

js library that groks xforms. most recent 2007-01 ; got error
on examples ;

Saved By: draganigajic | View Details | Give Thanks

Tags: , , , , ,

AJAXForms - How to use

AJAXForms - How to use

In order to use applications generated with AJAXForms it is
necessary to have a compatible browser with the activated
Javascript. However, if you want to transform XHTML/XForms pages to
HTML/Javascript it is necessary to have the following software: JRE
5.0 Apache Ant; last activity 2006-11

Saved By: draganigajic | View Details | Give Thanks

Tags: ,

Passing run-time parameters to internet applications

Determining the behaviour of an application at run-time using parameters is a well-established practice. But whilst it's possible with command-line and server-side applications, the scope for passing information to client-side internet applications is limited. With the growth in internet-facing desktop applications, widgets and gadgets, there is a need to pass parameters directly to the application, rather than via a server, and this post looks at how that might be achieved.<!--break-->
To illustrate, we can use the Unix command ls to see the contents of a directory, and add switches like -las to change the behaviour:

ls -las

Similarly, on the web we can pass parameters to server-side applications, using query strings:

h<!-- stop Drupal from making this into a link -->ttp://www.google.co.uk/search?q=ubiquity

Let's look at how something similar might be done on the client.
Using XPointer
We already have a mechanism to pass variables to a client, via the URI, and that's the XPointer Framework. I've described before how we use this technique in UBX Viewer to pass parameters that are to become meta and link values; as UBX Viewer loads it uses these settings to configure itself.
But there are a number of reasons why we now need something more general purpose, and it can easily be based on the same principles.
#vars(...)
The technique we're using with the Ubiquity libraries is to pass information to be used by the client in the vars XPointer.
For example, if we have a slideshow application, and want to create a bookmark for the third slide, we might just do it like this:

.../slideshow.html#3
However, if the application is also able to indicate which theme should be used, it is better to have the capacity to set more parameters, which vars gives us:

.../slideshow.html#vars(slide=3, theme=city)
#instance(...)
Another example of how run-time information might be passed concerns XForms applications.
In XForms it is possible to indicate the data to be used in the form by using the instance element. The element can either hold information directly:

<xf:instance>
<details xmlns="">
<name>Harry Angstrom</name>
</details>
</xf:instance>

or via an external file:

<xf:instance src="data.xml" />

However, when creating a generic application the initial data will inevitably be different for each user. In this situation we can use another XPointer, called instance:

.../createProfile.html#instance(name="Harry Angstrom")
This has the effect of populating the default instance in the default model, with an element called name, using the same rules as described in XForms 'lazy authoring'.
#src(...)
The final way that we might want to specify data at run-time is to indicate the @src value of an element, so as to cause a different file to be loaded at run-time.
For example, if we wanted the instance data to be loaded from a different location, we would ensure that the instance has an @id value in the document:

<xf:instance id="p" src="" />

and then specify the data source in the URL:

.../createProfile.html#src(p=data.xml)
Conclusion
As the number of client-side internet applications grows there is an increasing need to make them flexible. Passing run-time parameters via the URL is one way this can be achieved.

Ubiquity library

The Ubiquity library provides a range of open source components--from Ajax libraries to browser extensions--that work together to deliver a fresh approach to web application building.<!--break-->
Backplane
At its core, the library provides an Ajax backplane which gives programmers a consistent layer on top of a number of Ajax libraries.
Standard languages
This backplane is then used by Ubiquity modules that support a range of standards, such as XForms, RDFa, DOM 2 Events, XML Events, and more. These modules use unobtrusive javascript techniques, to bind the backplane functionality to the standard language elements.
Writing applications in standard languages makes them incredibly portable, and hides the intricacies of particular Ajax libraries.
But the Ubiquity library goes much further than just providing a set of Ajax libraries and standard languages.
Plug-ins and browser extensions
Ubiquity also includes a growing collection of binary plug-ins and browser extensions that can be called from the backplane. This is a powerful technique that we have called progressive browser enhancement, which simply means that web applications running in the browser can make use of any enhanced functionality that the user has chosen to install, but can still fall back to the JavaScript implementation if the functionality is not available. The range of extensions available includes full support for XForms, components for the easy creation of browser sidebars and toolbars, access to Microsoft Agent for speech, and more.
Desktop applications
The Ubiquity suite also allows programmers to completely break out of the browser. It includes a sophisticated desktop application framework that enables authors to create gadgets, widgets, site-specific browsers, and complete applications, using the same standard languages that are used in web applications.
The framework also makes it easy for programmers to create applications that can communicate with each other, create new windows, auto-hide, and so on, without the effort required when using compiled languages.
And simple APIs--available from XForms--allow authors to quickly create application installers that can create desktop shortcuts, and menu links.
Development environment
Finally, Ubiquity IDE is an open source development environment created using the Ubiquity library itself. It makes it easy for developers to create, test and deploy their web applications and components.
Ubiquity is the future of application development, whether in the desktop or web applications.

XRX

Bumped into XRX today. XForms + REST + XQuery. I like the sound of this, and XForms on the client just got a whole bunch easier…
I’m seeing multiple signs that the confluence of XForms and XQuery has legs. (And REST just plain makes sense in any situation). -m

The future of mark-up languages


This presentation by Mark Birbeck was given at the Kings of Code conference.
<!--break-->
Future Of Web Languages
View more documents from Mark Birbeck.

Presentation title: The future of mark-up languages (slides)
By: Mark Birbeck
Conference: Kings of Code, held at Pakhuis de Zwijger, in Amsterdam, on May 27th, 2008.

AttachmentSize

koc-logo-wide.png36.56 KB

Interview on Cubic Garden

Ian Forrester interviewed Mark Birbeck whilst they were both at XTech 2008. Subjects mentioned range from XForms, Ajax, Sidewinder, ODF, unobtrusive JavaScript, XUL, standards adoption, New Labour, Hegel's idealism, the Ajax Community, and the Ubiquity XForms processor.
<!--break-->

Building Mobile Applications with xH


This presentation by Mark Birbeck was part of the Reinventing the Mobile Browsing Experience Through Ajax industry panel, held at WWW2007.

XForms

XForms is a mark-up language from the W3C for describing all kinds of interactive user interfaces, from simple name and address forms, to shopping-carts, to long and detailed forms such as mortgage and life insurance applications, through to desktop applications.
The team at webBackplane has expertise and experience in XForms that is unparalled.
Not only do we have a wealth of experience using the language, earning us a reputation for creating innovative and easy-to-use forms (see XForms plays key role in financial services application from 1st Software), but we also know the language from the inside, having developed a number of the leading XForms processors.
Members of our team devised and created formsPlayer, the first XForms processor in the world to conform to the XForms standard, and the Ubiquity XForms processor, an open source Ajax library that uses XForms to define its features, rather than script.
As well as consulting, creating XForms applications, and building processors, we also help in the framing and honing of the standard by providing an Invited Expert to the W3C's XForms Working Group.
So whilst XForms is just one of many skill-sets that you will find in the webBackplane team, it is one at which we can rightly claim to be world leaders--which is why we created a focused division called Applied XForms, to provide XForms-related consultancy, training, application-building, and evangelism.

Yahoo! uses XForms for 'write once, run anywhere' mobile applications

Yahoo! recently announced their entry into the mobile web applications space, with a service that allows applications to be built and hosted using Blueprint, a purpose-built mark-up language based on XForms.

The Blueprint roadmap describes the underlying philosophy:

Much of Blueprint's philosophy and syntax comes from XForms. We opted for a full declarative language because it was the only way we could effectively run on the wide range of devices out there, some of which have no scripting at all. By using declarative syntax, we can encapsulate and hide the scripting specifics. In some cases, the code could run on the phone, in other case, such as XHTML, we can put the logic on our servers. It's the perfect way to deal with the various environments and their capabilities.

At the moment Blueprint is simply converted to XHTML plus JavaScript for delivery to devices, but the mention of XForms gives a clear indication of where they are heading. And given that Google did something similar with the launch of its Google Mashup Language, it all bodes well for a new wave of web applications that won't be built using JavaScript (or even Java and GWT) but will use straightforward, device-independent, mark-up.

Write once, run anywhere, anybody?

For more on why XForms is Ajax on steroids, see:

skimming at XML 2007 (and The Cloud's Silver Lining)

I've not yet had a chance to write up my experiences at XML 2007 in Boston last week, but an announcement today by Amazon prompts me to at least summarise one of the talks I did, called XForms, REST, XQuery...skimming. (Slides)

It's a theme I've touched on a little in this blog, and have spoken on before (at an XML UK meeting, last year, and at XTECH 2007, this year), and the idea goes something like this; building web applications by dynamically generating user interfaces that contain data, is awkward, and difficult to maintain. Web services (which includes REST and APP) removes some of the dependency on databases by hiding the data behind a simple abstraction layer--a kind of 'ODBC for the web'--and XQuery takes this further by giving us a standard language to get at the data.

But XForms is the icing on the cake, since it gives us a rich-client language that can be deployed like traditional web applications, yet is one that ensures a clean separation of the data and the user interface.

During the course of the presentation I showed how incredibly easy it is to create an application with XForms, since forms can be first created on the desktop--loading and saving their data from local XML files--before being deployed to any type of web server. By creating static forms that load their own data, rather than the more common model of dynamically generating static files that contain data, we end up with files that are completely agnostic about where they are delivered from. My demonstrations took them from the desktop, to a simple web server, to eXist (an XML database).

But these applications could even run in 'the cloud', with no web-server. That may sound odd, but I could store any of these XForms applications in SVN or Amazon's S3 and they would work as well as if they were in IIS or Apache. This is the ultimate in simple maintenance and future-proofing, since you are no longer reliant on any particular operating system or server-side language...the forms just 'are'.

GData

The final step of my presentation was to take this a little further and show an XForm that interacts with Google's GData; the form is simple, and accepts a longitude, latitude and comment which is then inserted as a row into a Google Spreadsheet, using Atom Publishing Protocol (APP). Another form is then used to retrieve the entire spreadsheet, and each row is used to create a pin on a map.

The great thing about this demonstration is that it shows that not only are our forms now agnostic about where they run--desktop, server-side, S3, etc.--but now the data becomes agnostic; we don't care how the data is stored, all we are concerned about is the protocol used to interact with it.

And crucailly, XForms' ability to get at this data shows that it really is the missing link when it comes to building a new kind of web application.

SimpleDB

But this generalisation about data just took another leap with the announcement today by Amazon of a closed beta called SimpleDB. This will allow programmers to store and query for data in a manner similar to the way that GData works.

By putting data into the cloud, and then using an easily deployed, declarative rich-client language like XForms, it is possible for the architecture of web applications to be altered in a quite fundamental way, in a direction that is completely different to what we're used to.

FormFaces.com

FormFaces.com

An EcmaScript library for transforming XForms data to XHTML 1.0

Saved By: clacke | View Details | Give Thanks

Tags: , , , , ,

Sidewinder and the need for a semantic web applications framework

A couple of recent discussions in the RDFa and microformat communities concern areas of particular interest to those of us working on Sidewinder, a semantic web applications framework.

The initial discussion is taking place on the microformats lists, and concerns how to allow authors to indicate what actions are available to be performed on items appearing in a document. The second discussion is taking place on the 'RDF in XHTML Task Force' list; this post provides a good summary of some of the issues.

All in all I find these very exciting discussions, because they concern exactly the types of use-case that prompted me to get involved with the XHTML work at the W3C a number of years ago.

This was because I'd been trying to create the kind of flexible user interface that these threads are describing--no doubt just as lots of other people had--and in my own endeavours I ran up against a number of very serious problems that made me conclude that it was pretty much impossible with the technologies available at the time. And since I still haven't seen a convincing solution to the problem of creating extremely flexible user interfaces, I've concluded that the issues I ran up against are of quite a fundamental nature.

Some of the problems that seem to me to be absolutely necessary to solve are:

  • an HTML page contains insufficient metadata about what its content 'means', making it difficult to work out what kind of UI constructs to render;
  • even were you are able to work out what the data means, HTML is not itself powerful enough to express the kinds of complex user interfaces that you would want to 'bind' to this underlying data;
  • and even if you work out what the data means and define complex UI components, you still can't define binding rules that indicate what widget to use with what data;
  • the browser offers only one 'paradigm' for interacting with information of interest, whilst we often want to create applications that can make use of the same rich features.

For every problem...

The first problem--that HTML is not 'rich' enough--is now largely solved by RDFa. It has taken quite a long time to get here, but I think the effort that has gone into getting RDFa right is going to be worth it. The key thing that RDFa does is to get RDF into HTML--once you've got that, all sorts of possibilities open up.

The second problem--that it's difficult to define rich user interfaces with only HTML--is largely solved by XForms. That XForms is a solution is currently not obvious to most people so XForms remains peripheral in application development at the moment. Of course it is possible to define widgets using script but it quickly gets very messy. There is also an enormous problem of re-use, in the recursive sense; most Ajax libraries are works of art, but very few can support the kind of complexity we need. Take the example shown here:

Metabar showing metadata for a BBC news story

Here we have widgets that are made up of other widgets to an arbitrary depth, but the key thing is that the binding mechanism is based on abstractions; it could be the run-time data type or an abstract widget type, and in both cases it means that at any point in the hierarchy a different widget could be swapped in without disturbing anything above or below. This kind of complexity is extremely difficult to achieve with procedural languages. (See also Introduction to custom controls and Understanding the MVC separation.)

The third problem--the use of binding rules to indicate which widget should be connected to what data--is still a little in the air. One part of it we've solved by specifying binding 'rules' using XPath selectors that are data type aware. This means that we can indicate that data of type 'geo location' should have one set of behaviour bound to it, whilst data of type 'time' can have a different type. These are essentially binding stylesheets and I think this is where we can answer the question posed on the RDFa list as to whether it is the author, the end-user or the browser vendor that should be in control of the widgets--the answer is all of them! By allowing users to express binding rules that override those from authors, we can achieve the best of both worlds.

Finally, the problem that the only paradigm we have for interacting with web-based data is 'browsing' is what we are trying to solve with Sidewinder. The ultimate goal is to have a framework that can be used to build any type of internet-facing application, whether web or desktop based. By allowing all applications to make use of the same semantic functionality and the same binding rules we can allow the users themselves to get control of their data and their applications. (See also Web 2.0, Copernicus and Sparticus: Moving the centre of the web.)

Silverlight clock as a custom control in XForms/formsPlayer

Once you have this kind of 'platform' (see Platform 2.0) then things really start to open up. I could build a clock widget using Silverlight, perhaps, and have that appear anywhere that the time data type is used--whether in my messaging client, my email client, my Twitter gadget, my Facebook desktop notification system, and so on. But you might choose a clock built using SVG, whilst someone else might decide to have a clock that speaks. But any of us could swap one of these behaviours for another at will, for a component we have created or one that we have downloaded from elsewhere--the ultimate, flexible, programming platform.

Ajax and progressive browser enhancement

Progressive enhancement is an approach to web development that has been around for a few years now. (More on PE at Wikipedia.) At its most basic it suggests building our web pages in a 'clean' and uncluttered way, and then layering functionality onto the mark-up using various mechanisms, such as stylesheets and scripts. The idea is that browsers without the additional capabilities can still render the page in some fashion, but those with additional power--such as scripting support--can add more enhanced features.

This principle actually underpins much of the work we've been doing on XHTML 2, which has involved taking HTML back to its semantic roots. In particular the work on RDFa has been to a large extent motivated by providing more semantic 'hooks' on which to attach increasingly focused functionality. (The work pre-dates the term progressive enhancement, so it isn't generally called that.)

But there is a new phenomena afoot, which I'd like to call progressive browser enhancement. It's something we've been doing for a while with our work on XForms and formsPlayer, but it also has wider applicability.

DOM Events and standards

To illustrate the idea of PBE, let's look at eventing in the browser. Many Ajax libraries have their own eventing architecture, and they are without exception non-standard. This is a shame, since the W3C has a standard for DOM events (DOM 2 Events) which has been around for years and is very clearly defined. Of course, part of the problem is that whilst it has been implemented in Firefox, Safari and Opera, it's not available in Internet Explorer. This meant that when we began our work on formsPlayer, our XForms processor plug-in for Internet Explorer, we had to implement a DOM 2 Events component ourselves.

This does however mean that DOM 2 Events support is potentially available for all browsers, but of course the problem now is that in order to make use of it on IE, people would have to install formsPlayer. And even if we made the module available separately (which we will be doing shortly), the problem for the programmer is that they can't assume that it is installed; there is still an annoying rift between those who have browsers with DOM 2 Events support, and those that don't.

Using JavaScript to enhance the browser

To fill the gap we simply implemented a DOM 2 Events library in JavaScript. Whilst most Ajax libraries went the route of creating their own non-standard eventing architectures, we went the other way and implemented the standard. The advantage of our approach is that if our end-user is running a browser with reasonable standards support such as Firefox, Opera or Safari, they'll get native support for DOM 2 Events, and hopefully a faster experience. Similarly, if our user is on IE and has installed the formsPlayer DOM 2 Events component, they will likewise get a faster experience. It's only the middle group using the scripted version of DOM 2 Events who will have a slightly slower experience.

But the key point is that the end-user now has some control, since they can add a DOM 2 Event component if they want to--most likely as part of some other package--independent of the actual web applications they are using. And for the authors of web applications life is much easier, since they are coding to a standard, rather than being forced to code to the specific event architecture of YUI, Dojo, or whatever Ajax library they want to use.

This is the key idea of progressive browser enhancement.

Threading in Google Gears

Another example of PBE is threading in Google Gears. There are a number of JavaScript libraries around that create simple threading by using the timer in JavaScript. This is fine for a lot of uses but can affect performance. However, we can follow the same approach as I described above for DOM 2 Events; if the function calls that the programmer makes to create a thread are 'standard', then although in normal operation the less-efficient JavaScript version would be used, with no change to the code the web application can take advantage of 'proper' threading, should a user have Google Gears installed. (See also: Ajax makes browser choice irrelevant...but we still need standards.)

Of course, most users are unlikely to be looking for a threading library to install, just as they will not be downloading a DOM 2 Events module. But if these components are small enough to be bundled up with other pieces of software they will gradually find their way onto users machines as part of other, useful, packages.

However the distribution takes place, it's the end-users of our web applications that are in control of progressively enhancing their browser, not the web application programmers themselves.

These principles have underpinned the design of Yowl, a centralised notification system for web applications.

Yowl centralised notification system

Yowl is a way of providing notifications to users of web applications, but in a way that the user themselves can control. It was inspired by Growl, which runs on the Mac, and which is used by applications such as Skype and Adium; by passing all notifications through a central system users are given the power to decide which messages they are interested in, and how they want to see--or even hear--them.

Progressive browser enhancement allows Yowl notifications to make use of advanced features in the browser if they are available, but to fall back to basic notifications if not. For example, we've created a Windows component that allows messages to be displayed above the system tray. The component is invoked and called from script, and works with both Firefox and Internet Explorer:

Yowl notifications in IE with Sidewinder system tray component

However, if the systray component is not installed, the Yowl notification system will simply use JavaScript to show messages within the browser window. You can see a sample of the non-enhanced notifications here--it will run in all the major browsers:

Yowl notifications running in Firefox

The programmer need change nothing in their code to make use of the systray component if it is present, since as with the DOM 2 Events example, or Google Gears and threading, the user is in control of the browser enhancement, not the programmer.

(For more on Yowl see the Yowl open source project page, Yowl: Design principles and how to use it and Yowl: An open source centralised notification system.)

Where does this leave the browser?

There is still plenty of scope for the browser to evolve and make available the kind of features we're talking about here. But the truth is that progressive browser enhancement makes browser evolution far less significant than it has been until now. That's probably not a bad thing, given the chaos that is currently surrounding the development of HTML since the W3C gave its support to HTML 5; the spec itself is becoming increasingly top-heavy, and bears little relationship to the early principles of HTML. Far from having enormous 'kitchen-sink' specifications, PBE looks to add new features in a more nimble way, via small and focused modules.