Data Islands

Mark Birbeck's picture

The first layer of the WAB relates to managing XML data in the context of an XML DOM. A fairly common use of this is for a node in one DOM to 'manage' another DOM, or at least provide a point of connection between one DOM and another.

Any node in the DOM can be a point of connection to this data, as indicated by the presence of the instance property.

A pointer to the DOM node referred to by an element's instance property can be obtained either directly on the connecting node, or via the document.instance function. The single parameter is an ID.

In mark-up, an instance element serves the purpose of a connecting node. There are two ways to use the instance:

  1. the entity can be specified inline as children of instance;
  2. the instance could be empty, indicating an uninitialised instance.

NOTE: The data will be flexible in the way that XSLT is. So all of these are valid:

<instance>hello, world!</instance>
<instance>
  <node>1</node>
</instance>
<instance>
  <node>1</node>
  <node>2</node>
  <node>3</node>
</instance>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Data islands good, but I really want MVC++

We want to process XML data, so we wrap an instance around it. Then we wrap a model around that. The model can contain lots of information about the data, like schema and business rules. These declaratively establish properties of the data and relationships among the data.
The real kick, though, is that we also have the latter two parts of an MVC. The view attaches to the model and allows two-way communication with the data for presentment and modification. Really, the modification part is an implicit/degenerate controller that supplies only a certain type of modifiability. And if you want more, there is this controller module that allows you to string together lots of inserts, deletes, and sets to achieve a specialized purpose.
The nice bit about this messaging is that MVC is a tried and true design pattern, so it's not like we're asking people to bet the farm on something that is risky or unknown. People get this.
But what's really interesting to me is that the VC parts are really just two specific cases of modules that can attach to a model to consume or update the data being managed by the module.
So, by MVC++ I mean that we have a model that any module can attach to in order to consume or update the data. Two other exciting modules that have come to our attention are submission and signatures.
Using event glue, these additional modules can meaningfully interact with the model. But, it also seems clear that even the view and controller modules could be written so that they interact with the model in exactly the same way, using events.
That's an implementation, of course, but the interaction between the model and the repeat module, the submission module, and the signature module can all be explained in the same way. This causes me to believe that events gives us a way of explaining how modules interact without having to invent custom plumbing for each new module that has to interact with the model.

Content model for instance

Right now, we allow an instance to contain a well-formed XML doc only, not arbitrary content.
In the arbitrary content case, there's no way to form an xpath data model over it to allow access to the data by other modules, like views and actions.
Are there real use cases for not insisting that the XML backplane is about processing XML data?
I think there is something to be said for being able to receive non-XML as the result of a submission, but to me this is really an argument to say that we need tighter control over where the submission result goes in the XML instance data, in which case we wouldn't have to insist on submissions returning XML.

Mark Birbeck's picture

Generating text files

The reason I suggested loosening things was that I didn't see any reason why we couldn't use XForms to produce a text file, for example. We can do that with XSLT.

Data island lifecycle and events

We've discussed on the telecon a few issues around the lifecycle of data islands...in particular:

  1. Some notion of "transactional" boundaries around a set of related changes -- which can be made before triggering any (optional) dependency graph evaluation.
  2. A corresponding API on the data island with, for example, startUpdate() and endUpdate() methods.
  3. Corresponding informational events dispatched on the instance.
  4. Scoping or ordering of update notifications? I'm still thinking about a use case where I have two sets of components binding to a model, say a UI and a controller. I want my controller component to get value-change notifications before the UI so I have a chance to do other actions before the UI gets notified...but I don't want to put my controller inside the model. I might be willing to use some type of grouping around the model and controller to achieve this, while still allowing the UI to reference model elements nested inside the group. My main point here is to raise the question of whether a simple UI-like binding is adequate for the backplane or whether addition control over the order or priority of update nofications is required. It's probably not an issue for the 1st release of the document, but I'd be interested in any comments.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.