A New Paradigm: "Continuations"?

My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2004/3/18/a-new-paradigm-quotcontinuationsquot.html
Published Thursday, March 18, 2004 5:04 PM by RoyOsherove
Filed under:

Comments

Thursday, March 18, 2004 1:51 PM by denny

# re: A New Paradigm: "Continuations"?

Hi Roy!

Funny but about 2-3 years back... right when asp.net was in beta I did an app that was very much like what you are describing.....

it was classic asp.

it used a database table to store an xml document that was the "Form" the user filled in.
another table set has the "statemap" of next,back and maped it to a button menu
( some buttons maped to more than one page/form)
the "User state" was stored in another table set .... parent table was "the order" child tables were "Data from a page"

whole boatload of msxml processing code in the asp version that might be a lot less if I port this to .net

basicly it had one form that every screen did a postback to like .net
and on the server side it found the "template" in the database and then looked for a matching xml data document and dumped the data into the form and then pushed it back to the user....

when the user hit the "Next" or "Jump" buttons the server did a for-each-var loop and built an xml doc and then posted it back to the database.

on entry to the system it used a client side cookie with an id number to see if you had an "In Progress" order to re-start
and if you did it would take you back to the last page you had open....

it workes very well, fast, minmal server siade state.

what I did not get funded to do was write the "forms editor" to update the control tables with the xml.

if anyone is interested in how I did this etc... send a msg. to denny at my domain
Figuerres.com

Thursday, March 18, 2004 2:03 PM by Jesse Ezell

# re: A New Paradigm: "Continuations"?

There is a .NET version of Prevalence, which is mentioned in the article as the foundation for many of these apps. So, you could easily support this with .NET.
Thursday, March 18, 2004 3:14 PM by David Naseby

# re: A New Paradigm: "Continuations"?

Prevalence is not the foundation of Continuation-based web servers - not even Prevayler is. Continuations are sort of like goto's with context. The only languages I know of for continuation support are Scheme, SML NJ, Smalltalk (now Avi Bryant has written them in), and Ruby, although there may be more.

The theory of continuations is kind of hard to wrap your head around, but the practice of writing web apps in Seaside (Avi Bryant's smalltalk Continuation-based framework) is incredibly simple.
Thursday, March 18, 2004 5:01 PM by anonymous coward

# re: A New Paradigm: "Continuations"?

scheme, ST, SML/NJ, ruby , unlambda and a rhino (javascript) fork.
But there is a continuation based system even for CLISP.

I suggest you to take a look at the code for borges (I believe ruby is the most clear for casual readers beetween all this languages.)
Thursday, March 18, 2004 5:07 PM by Richard Tallent

# re: A New Paradigm: "Continuations"?

Not exactly the way I've heard it described before, but a good goal. More:

http://www.tallent.us/CommentView.aspx?guid=23695cd8-957b-41c6-be3e-4e121c5565b8
Friday, March 19, 2004 10:43 AM by Darrell

# re: A New Paradigm: "Continuations"?

Technically all you really need to do is save the cumulative state in viewstate. Not that I am recommending this, but it's not that complex an idea or application to do.

Is it great that someone has written a framework to do it? Yes.

I'll just stick with the UIP. I haven't had a problem with the Back button on the UIP.
Friday, March 19, 2004 11:15 PM by Paul

# re: A New Paradigm: "Continuations"?

Continuations in Ruby, Lisp, Smalltalk, etc... let you specify a code to execute after you function has executed. Something to do instead of 'return'...

Continuations in web development (ala Seaside most recently) are a bit different but use the same metaphor. I'd almost compare them to the new iterator support in the next rev of C# - the 'yield' statement. Continuations in web development let you write code like this.

Get state from user
lookup all cities for state
let user select city
lookup all locations in city
ask user for location

So in smalltalk or other dynamic languages this means you are writing a work flow with a single bit of code, as opposed to ASP.NET where you write your code on a postback by postback basis. In .NET the example would look like

if state = 0 {
Get State from user
set state = 1
}
if state = 1 {
Lookup all cities for state
set state = 2
}

and on. so mostly it's about a simpler developer experience. The downside to these are that it's all session managed. Either you put it in the URL and have fugly URL's or you put it in a cookie and can't run the same app twice from different windows of the same browser (cookies are shared).

If you know smalltalk - snag a copy of squeak and seaside - it's kind of fun!

Sunday, April 04, 2004 7:58 PM by Antonio Gallardo

# re: A New Paradigm: "Continuations"?

Hi:

Take a loos at Apache Cocoon FlowEngine:

http://cocoon.apache.org/2.1/userdocs/flow/index.html

Currently in the CVS is a JavaFlow implementation. Groovy Flow Engine implementation will be soon.