Databases Reference
In-Depth Information
Logic to validate
field-level data
and display rules
Figure 9.7 The breakdown of code
used in a typical forms applications
when an RDBMS, middle-tier objects,
and JavaScript are used. Middle-tier
objects are moved to and from a
model within the client. XRX attempts
to automate all but the critical
business logic components of forms
processing (top-left wedge).
Object-relational
mapping
Updating view
elements from
model
Binding model
to view
elements
AJAX calls
and libraries
the user selects Save, the updated model data is stored on the server. Figure 9.7 shows
a typical breakdown of code needed to implement business forms using a standard
model and view architecture.
From the figure, you can see that close to 90% of this code is similar for most busi-
ness forms and involves moving data between layers. This code does all the work of
getting data in and out of the database and moving the data around the forms as users
fill in the fields. These steps include transferring the data to a middle tier, then mov-
ing the code into the model of the browser, and finally, when the user clicks Save, the
path is reversed.
XRX attempts to automate all generic code that moves the data. In turn, the soft-
ware developer focuses on selecting and validating field-level controls as the user
enters the data and the logic to conditionally display the form. This architecture has a
positive impact on agility, and it empowers nonprogrammers to build robust applica-
tions without ever learning JavaScript or object-
relational mapping systems.
Figure 9.8 shows how this works within the XRX
web application architecture.
With XForms, the entire structure that you're
editing is stored as an XML document within the
model of the browser. On the server side, docu-
ment stores, such as a native XML database, are
used to store these structures. The beauty of this
architecture is there's no conversion or need for
object-relational mapping; everything fits together
like a hand in a glove.
Most native XML databases come with a built-in
REST interface. This is where the R in XRX comes
in. XForms allows you to add a single XML element
called <submission> to specify how the Save button
on your form will call a REST function on your
server. These functions are usually written in
XQuery, the final X in XRX .
Browser
XML database
Model
Save
Update
View
Figure 9.8 How XML files from a
native XML database are loaded into
the model of an XForms application.
This is an example of a zero-translation
architecture. Once the XML data is
loaded into the XForms model, views
will allow the user to edit model
content in a web form. When the user
selects Save, the instance data in the
model is saved directly to the database
without the need for translation into
objects or tables. No object-relational
mapping layer is needed.
Search WWH ::




Custom Search