An example of Web-O-Matic


next up previous
Next: An overview of Web-O-Matic and WOM
Up: The means: Web programming with objects
Previous: Constraints between objects

An example of Web-O-Matic

 

The above style of description carries over almost verbatim into Web-O-Matic. Here is a complete page definition, including the HTML parts. To simplify the example, I have left out the formatting required to make the page look neat - in practice, one would probably align the field and the result by putting them inside a table. I have also assumed that there is a built-in function for calculating factorials, whereas it would actually be necessary to specify the process of invoking a particular program - D:\FACTORIAL\FAC.EXE perhaps - and waiting for it to finish running.

The meaning of <IntegerField i> is that the page contains an IntegerField, to be referred to locally as i, to be created when the page is. Similarly for Text result. In conventional OOP terminology, these commands create instances of classes IntegerField and Text. In the current implementation, both classes are built into the WOM run-time library, so the programmer need not define them.

The equations between <OnSubmit> and </OnSubmit> describe the relation between these fields. result~value denotes the value attribute of result, using ~ as an attribute selector. In conventional OOP, this would be a method call.

To explain the meaning of [t] and (t>0), we need to introduce time. We can regard an HTML form as having a local time co-ordinate system, in which it is created at , the first Submit happens at , the second at , and so on. Then result~value[t] means the value of result~value at time . result~value[1] would be the value just after the form has been submitted for the first time.

The (t>0) is the closest a normal keyboard can get to the logical notation , ``For all such that ''. So the second equation

means ``the value attribute to be displayed in the result space result just after the th submission is the value attribute of the input field i at the same time, if the error attribute of the field at this time is false''. The restriction to means that the equation must hold after all submissions, but not at when the page is created. At that time, i does not contain anything whose factorial needs to be calculated.


next up previous
Next: An overview of Web-O-Matic and WOM
Up: The means: Web programming with objects
Previous: Constraints between objects



Jocelyn Ireson-Paine
Sat Oct 12 23:35:52 BST 1996