The Evolution of Web Programming


Presented by Greg Pettyjohn
Transcribed by Owen Landgren

In 1994, the standard practice in web programming was the Common Gateway Interface(CGI). CGI was originally intended for the translation of static data, but was coopted for programmatic use. CGI gateways create a direct binding between a URL and a script on the web server. Data input to the script was handled through information found in the environment or encoded in the URL, and the script output data directly to the standard output. CGI had several problems - I/O was restricted to flat strings, it lacked a means to mainatin state between interactions with the script, and it was inefficient and hard to refactor. Further, each invocation of the script created a separate process, which was highly inefficient.

Also in 1994, Rasmus Lerdorf released PHP,the first pure web programming language. The main innovation of PHP was found in the simplification of I/O operations. Instead of writing a program, programmers wrote a web page that had markup within it. This markup was processed by the PHP preprocessor and the code therein executed. It was noted that this is just a buggy reimplementation of quasiquote. PHP dealt with persistent state through the use of external libraries. Similar languages appeared later for Java and .NET, (JSP and ASP respectively).

In 1999, Atkins, Ball, Bruns, and Cox introduced Mawl, a specialized language for web programming developed at Bell Labs. Mawl formalized several useful ideas - template primitives, a form programming language, the idea of a "session" with the user, and a type system for web programming - into a concrete programming language. A brief demonstration showed how Mawl separates program logic from HTML layout and content presentation logic. Data input into a layout file was done with the format < Input Name = Id >, and information was referenced with the form < MVAR Name = Id >. Examples of the specific syntax of this language can be found at http://www.bell-labs.com/project/MAWL/zoo/general/. The Mawl type system maps form types directly to function types, and knowing the type of a function will allow us to completely infer the actual code of the form. In essence, Mawl applies the Curry-Howard isomorphism to a subset of the web programming problem.

Mawl still has problems, however. It encourages a purely imperative style, and such an imperative style often means that even with Session information valuable data about past interactions with the user will be lost. Further, the implementation of quasiquote in the templating language is still lacking power and expressiveness, even though it adds a primitive mapping construct.

1999 was a fruitful year, as it also saw publication of the < bigwig > programming language by Braband et al. < Bigwig > was a direct descendant of Mawl, and took a software engineering approach to the problem of web scripting. Among other contributions, the < bigwig > authors identified several paradigms in web programming languages. "Script-centered" programs took the old-fashioned CGI approach, where "page-centered" programs attacked the problem along the lines of PHP. "Session-centered" languages such as Mawl allowed the programmer to think in broader terms, but < bigwig > takes the concept one step further, introducing the service. A service is a collection of sessions that are similar in some way. The < bigwig > language itself adds validation of form fields, syntactic macros, and alters the way the back button operates to more accurately mesh with the session model of computation.

Originally developed in 1998, John Hughes published a paper detailing how to use Haskell to do web programming using a construct called Arrows in 2000. His main insight was that the information that was being lost when state was being updated could be naturally encoded in the form of a continuation.

Finally, we hit the year 2000 and the work that Graunke et al. did on web programming. By using Scheme and starting with the "correct" conceptual framework, Graunke is able to solve these problems in a more efficient manner. The utilities provided by MrEd allow the web programmer to use threads and bypass the "one procedure per interaction" problem. Scheme also gives the programmer the power of real quasiquote, without needing to worry about marshalling data. By storing first-class continuations server-side and encoding a link to that continuation in the URL, the PLT server gets interactions naturally. Sessions are completely free, and the back button works perfectly. However, problems with persistent state still exist, and are open at this time. The presence of first-class continuations also allows the creation of useful tools such as (send/suspend/dispatch ...), which allow for more abstract web programming.

One of the audience members suggested that the problems with state might be related to Baudin's PhD thesis on linear and proof nets, where the edges of the net are composed with the varying interactions between server and client.