You are here: Home > What's New > How to Create XML-Based Systems

How to Create XML-Based Systems

An implicit tenet of the XML technologies is that data is a first-class citizen—it is not to be hidden away in a closet, behind locked doors. Data should be:

Example: Consider medical records: I want to see my medical records. (Visible) I want to read them. (Declarative) I want to send them to a specialist when the need arises. (Mobile) I want the specialist and my primary care physician to process the records in their own ways. (Manipulatable)

In another article I describe stateless versus stateful functions. In that article I show that with a stateless function the result is always the same when the function is given the same argument—call a square root function twice with the argument 9 and the result will be 3 each time. In a stateful function the results may be different—call a bank withdraw function twice with the argument $25 and the result will be different each time. The withdraw function maintains a record of the bank balance and decrements it on each call. Thus the withdraw function not only computes a result but also changes a variable. The latter is called a side-effect. In the article I describe how to convert a stateful function into a stateless function: record the user's bank transactions in an XML document and call the new withdraw function with two arguments—the amount to withdraw and the XML document. The new withdraw function is side-effect-free. Writing programs such that its functions are side-effect-free is known as functional programming.

In the first withdraw function the bank balance data is not a first-class citizen—it is locked behind the closed doors of programming code.

In the new withdraw function the data is set free—an XML document records the initial balance and each bank transaction. The system—user, withdraw function, and bank record (XML document)—possesses all the qualities deemed good by the XML community: the data is visible, declaratively expressed, mobile, and amenable to multiple different side-effect-free manipulations.

Now you know how to create XML-based systems.

Translations

This page was translated to Georgian by Ana Mirilashvili.

This page was translated to Norwegian by Lars Olden.

This page was translated to Swedish by Eric Karlsson.

Last Updated: August 10, 2020