During the JAOO conference in Aarhus this year, I attended a seminar on Seaside: A Radical Web Framework help by Glenn Vanderburg. This seminar inspired me to have a go at continuations using PHP. Seaside is a SmallTalk Web Framework that facilitates continuations and make it possible for the user to step backwards in the "call stack" via the normal browser back and forward buttons.Why is this interesting? Normally the flow of a web application is controlled by the design implemented in HTML, XHTML, XML, XSLT or whatever. Using the continuations one is able to control the work flow through the application from the core code, e.g. written in PHP. Glenn demonstrated avery simple, but yet impressive, use of continuations. The example was a simple counter, it featured a label indicating the current value and two links one for incrementing the value and one for decrementing the value. Clicking the links modified the value displayed by the label. In normal web frameworks, incrementing the counter a couple of times, say 5, and pressing the back button twice would display the value of 3 in the label. However, refreshing that webpage would update the label with the value that the server thinks is the current state. This may seem correct to some, but it may be annoying to the user -- what if she wanted to revert the system to a previous state? Using the continuations, pressing the back button of the browser will revert the application state to whatever it was previously. In the case of the counter example, putting the application in a state displaying the value 5, followed by two clicks on the back button again followed by an update of the page REALLY should display the value 3.
Download phpcontinuation-0_1.zip
Tuesday, January 30, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment