continuation-based-web-framework

see-also: continuation(programming)

Continuation-based web framework is a kind of web framework that do things differently.

Currently the two most famous such frameworks are Seaside for Smalltalk and Racket's web-server. Other such framework exists, but not nearly as famous, since this kind of framework fell out of favor a long time ago.

It took me multiple takes to finally understand what the core difference is, but basically, in a traditional MVC multi-page application, a stage in the possible interaction between the user and the webapp is fulfilled/represented by a route and all the thing it takes to support that route; while with a continuation-based web framework, a stage is fulfilled/represented by a continuation, which in the case of Racket's web-server library could be stored on the server or on the client's side. (Routes, of course, are static and pre-defined.)

(Also, a stage of interaction in a modern single-page application is represented by specific values of the application state; such apps could also maintain an illusion of routes existing in the meanwhile.)

The implication of this, is that when the application is written with a common web framework, routes are important and apparent in the source code but the transitions between stages aren't; but when the application is written with a continuation-based web framework, the transitions betweens stages are apparent in the source code as if it were a native command line app, but there aren't any hard-coded routes.

(Of course, you can add hard-coded routes back into your application with Racket Web Server's URL dispatch facilities, but the main part stays the same.)

fig_01.png

Figure 1: A diagram depicting the structure of a possible web app done in the common way (upper half) and with a continuation-based framework (lower half). Notice the lack of URL route allocation in the lower half. The reason why dashed lines are used in the upper half is because the links don't truly exist other than the fact that "they are the same string"; in the other hand, functions that are responsible for the HTTP responses are actually directly referred within the code base, at least that's the case with Racket Web Framework.


2024.7.28

Back