Once in a while, an idea will strike you with great force, and you say "Why didn’t I think of that?" The history of programming the Web is a sequence of innovations in abstraction, each of which might make you utter the aforementioned phrase.
The Web is supported by an array of interlocked standards, including HTTP, HTML, CSS, CGI, and JavaScript. On top of these have been built a series of abstractions, each increasing the ease with which a Web application can be designed and implemented.
One of the earliest of these abstractions appeared at the end of the last millennium, when Atkins, Ball, Bruns, and Cox1 devised MAWL, the Mother of All Web Languages. MAWL introduced to the Web world the now-common idea of inversion of control, where a sequence of requests from users invoking programs that generate Web pages is instead viewed as a single program generating a sequence of pages to which users respond. My first attempts to come to grips with inversion of control hurt my brain, but within a few years it acquired firm foundations in theory, relating it to well-understood notions of continuations and continuation-passing style, thanks to the efforts of Queinnec7 and the PLT Scheme (now Racket) team of Graunke, Findler, Krishnamurthi, Van Der Hoeven, and Felleisen.4
Web programming was complex because it involved a plethora of programs written in different languages running on different platforms. Typically, a three-tier system consisted of JavaScript on the client, Java (or some other language) on the server, and SQL on the database. The idea of generating all three tiers from a single source was christened "programming without tiers" by Cooper, Lindley, Wadler, and Yallop.2 Many systems independently appeared generating two or three tiers from a single source, including Google’s AWT and Microsoft’s LINQ, and research-oriented systems including Ocsygen, Opa, and Hop.
Advanced as these systems were, even as simple a matter as entering a date on a form could be complex. It might be input as a single string from a form that needed to be parsed, or three drop-down menus for day, month, and year that need to be assembled, or through a calendar widget in JavaScript. It was not until 2006 that I saw the iData system of Plasmeijer and Achten,6 which suggested Web systems should abstract away from such detail, introducing model-view abstraction to Web forms, encapsulating how data was input separately from how it was to be processed. An obvious idea—but only in retrospect. Cooper, Lindley, Wadler, and Yallop3 reworked this aspect of iData into formlets. Just as inversion of control was easier to absorb once it was related to the known notion of continuations, so formlets benefited from fitting into the known notion of applicatives, as introduced by McBride and Patterson.5 The theory aided practice: developers wrote formlet libraries for F#, Haskell, JavaScript, and Racket, and incorporated formlet support into frameworks including Happstack, Tupil, Web-Sharper, and Yesod.
The following paper presents the next step. Until now, the database in a Web application has been treated as a global variable, accessible to all. Chlipala suggests a better approach: allow each module to declare locally a portion of the database relevant to its needs, and hide that portion from the other modules. He also introduces primitives to support concurrency and transaction, with a more elegant design than found in most other Web languages. Finally, he suggests a novel form of functional reactive programming that incorporates imperative actions. How the latter compares with the more declarative form of functional reactive programming found in languages such as Elm remains to be seen. Chlipala has tried these techniques in practice, and an intriguing list of his early customers may be found in the research version of this paper, which appeared in POPL 2015.
Until now, the database in a Web application has been treated as a global variable, accessible to all. Chlipala suggests a better approach.
Modularizing database access is a simple idea of enormous power, and I expect it will be coming to a Web programming language near you soon. Why didn’t I think of that?
Join the Discussion (0)
Become a Member or Sign In to Post a Comment