Seaside: A Web Framework in Smalltalk

By Deane Barker on July 19, 2009

Seaside: Your Next Web Application Framework: This is a look at a Web framework written in Smalltalk.  Now, I know, we need another framework like we need a hole in the head, but what I found really interesting was at the top of page 2 – a discussion of “continuation-based programming.”


[…] instead of having to throw away or explicitly save all local state after a web page is generated and recreating it all again on the next hit, you can pretend the web isn’t even involved.

They provide this code sample, which is pretty easy to figure out, even if you don’t know anything about Smalltalk.

self showFirstPage.
[self validate] whileFalse: [self showCorrectionPage].
self showLastPage.

Here’s an explanation:

[…] this code reads almost exactly as what it’s doing: Show the first page (probably containing a form), and when the page is submitted, determine if the form elements are valid. If not, keep showing the correction page until it comes back correct. Finally, show the last page.

Simple enough, but consider this cool part, which essentially says that the system is able to toss back HTML in the middle of execution, then pick up where it left off when the form is submitted.

showFirstPage is clearly returning a pile of HTML back to the user (using canvas and brushes like we saw earlier). But as the page is being returned to the user, Seaside notes that it’s about to execute the second line of this method and transparently arranges for the form submission to restore this method execution right at that spot.



Comments are closed. If you have something you really want to say, tweet @gadgetopia.