Web Applications

There's a demo, I think its via Seaside, of a command line application which is trivially ported to a web application thanks to the power of continuations.

Another example of a 'command line' type application which is easily ported to a web application via continuations is the Modal Web Server example 3. In that example the 'flow' of the code is unchanged, only the functions for retrieving input and displaying the result are modified.

Essentially the readLine() type functionality common with command line tools is replaced by a continuation.

A good presentiation of the benefits of Continuations is web applications can be found here. The source of a complete number guess game that uses continuations can be found here. It boils down to control being returned to the user when the pause() method is called and this serves at the same time as a marker to resume execution from afterwards.

Workflow and Service Correlation

Increasingly as we glue together services, be they web applications, Web Services, MOM and SOA type services, we need to handle long running workflows and things should be asynchronous. e.g. a workflow may take 1 year to complete.

However using a simple sequential programming model is much simpler than the asynchronous alternative.

Continuations allow us an easy way to suspend execution of a workflow/correlation at the point of a wait/correlation state, so that the thread of control can be serialised nicely and resumed when the next message/event occurs, maybe some long time ahead.

Implementing Dynamic Languages

Various dynamic languages support continuations like Squeek and Ruby. Being able to make effficient ports of these languages which work effectively with existing Java code requires native continuations support

Resources