Research and Advances
Computing Applications Research highlights

Technical Perspective: Why Didn’t I Think of That?

  1. Article
  2. References
  3. Author
  4. Footnotes
Read the related Research Paper

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?

Back to Top

Back to Top

Back to Top

    1. Atkins, D.L., Ball, T., Bruns, G. and Cox, K. Mawl: A domain-specific language for form-based services. IEEE Trans. Software Engineering 25, 3 (1999), 334–346.

    2. Cooper, E., Lindley, S., Wadler, P. and Yallop, J. Links: Web programming without tiers. Formal Methods for Components and Objects. Springer, 2007, 266–296.

    3. Cooper, E., Lindley, S., Wadler, P. and Yallop, J. The essence of form abstraction. In Proceedings of the Asian Symposium on Programming Languages and Systems. Springer, 2008, 205–220.

    4. Graunke, P., Krishnamurthi, S., Van Der Hoeven, S. and Felleisen, M. Programming the Web with high-level programming languages. In Proceedings of the European Symposium on Programming. Springer, 2001, 122–136.

    5. McBride, C. and Paterson, R. Applicative programming with effects. J. Functional Programming 18, 1 (2008), 1–13.

    6. Plasmeijer, R. and Achten, P. idata for the World Wide Web—Programming interconnected Web forms. In Proceedings of the International Symposium on Functional and Logic Programming. Springer, 2006, 242–258.

    7. Queinnec, C. The influence of browsers on evaluators or, continuations to program Web servers. ACM SIGPLAN Notices 35 (2000), 23–33.

Join the Discussion (0)

Become a Member or Sign In to Post a Comment

The Latest from CACM

Shape the Future of Computing

ACM encourages its members to take a direct hand in shaping the future of the association. There are more ways than ever to get involved.

Get Involved

Communications of the ACM (CACM) is now a fully Open Access publication.

By opening CACM to the world, we hope to increase engagement among the broader computer science community and encourage non-members to discover the rich resources ACM has to offer.

Learn More