An Infernal Device
I believe that the techniques described in this software and documentation may be covered by a patent now owned by Yahoo: US Patent 6,205,469, "Method for client-server communications through a minimal interface", by Paul Graham while he was at ViaWeb. I have not used this technique outside the original work and would not myself recommend anyone else do so, either.
One of the greatest difficulties of writing web-based applications is the stateless nature of the Hyper-Text Transport Protocol. In particular, the stateless protocol makes the control structure of the application much less clear. One excellent approach to handling the control structure problem is the use of continuations, data structures which explicitly represent the control structure of a program. This library presents a framework for designing web applications, based on the research into continuations, which significantly clears up the control structure of web applications without requiring specialized languages or tools.
The initial version of the framework is written in PHP, although a Python version is planned and the fundamental idea is usable in any language.
The fundamental approach is to structure the application as a state machine, with user-visible web pages as the states and application code as the transitions. The application code is held in a class which has at least a single execute method. When a web page is sent to the browser, instances of the classes representing the transitions out of the state are also created and stored in the page (as either URL queries or form fields). When the URL is followed or the form submitted, the application can unserialize the transition and execute it.
- 21 July 2003: id-php-1.0: Inital public release of the PHP version.
GNU General Public License, Version 2