Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

December 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Nov  Jan

Use continuations to develop complex Web applications

Wednesday, December 29, 2004

Jonathan Bartlett mentioned on c.l.s. that IBM has put an article on their developerWorks web site titled "Use continuations to develop complex Web applications - A programming paradigm to simplify MVC for the Web". Although the article focuses on using continuations with the Apache Cocoon web development framework, it does provide a good introduction to continuation-based web application development frameworks in general. The author introduces the topic and summarizes his article nicely:

"Due to the inherent stateless nature of HTTP, Web technologies suffer from the problem of state information being forgotten between two successive user interactions. An interactive Web application consists of a collection of scripts wherein a single interaction comprises one script delivering a page to the browser (then ending), the user completing and submitting the form at some later point in time, and another (possibly different) script handling the submitted form. Thus, application logic is spread across a multitude of scripts.

Matters are further complicated by the fact that browsers allow users to backtrack in their interactions or clone an in-progress interaction and run both in parallel. Given this set of possibilities, a user can pursue multiple navigational paths within an application at any given time, and it's up to you to write code to ensure that each outcome is successful. Web development frameworks, such as Spring and Struts, allow you to handle multiple navigational paths, but they do so at the cost of increasing the complexity of an already overly complex code base.

In this article, I'll introduce a continuations-based alternative that can simplify the development of complex Web applications. I'll start with an introduction to continuations, including an argument for how the continuations-based approach can be a shot in the arm for the traditional MVC style of programming. Then I'll move on to a simple example: an enterprise application that demonstrates the advantages of using continuations in terms of ease of development and understanding of the application code. Because one of the chief disadvantages of using continuations is their lack of support on the Java platform, I'll use the Apache Cocoon framework to demonstrate a JavaScript implementation of the example program and a pure Java language one. I'll conclude with an overview of the pros and cons of using continuations."
If the article sparks an interest in continuation-based web application development frameworks, you might want to read some of my previous postings (and follow the links in those postings) on the topic (Note: these are listed in reverse-chronological order, so, if you want to preserve the "context" of the postings, read them from the bottom up): Dave Roberts also recently posted about the REST architectural style for web applications and later about a discussion he had with Marco Baringer (the author of UnCommon Web, a CL continuation-based web application development framework) on the relative merits of REST vs continuation-based approaches for developing web applications. Their discussion is worth reading as it is balanced and summarizes a lot of the pros/cons of both approaches. On the same REST/continuations topic, Anton van Straaten gave a presentation at the LL4 conference titled "Continuations continued: the REST of the computation" which gives a good overview of both REST and continuations and attempts to show that continuations are actually compatible with the REST model. The recorded presentation is also available.

emacs Copyright © 2005 by Bill Clementson