acm-header
Sign In

Communications of the ACM

Research highlights

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


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

References

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.

Back to Top

Author

Phil Wadler ([email protected]) is Professor of Theoretical Computer Science in the Laboratory for Foundations of Computer Science in the School of Informatics at the University of Edinburgh, Scotland.

Back to Top

Footnotes

To view the accompanying paper, visit doi.acm.org/10.1145/2958736


Copyright held by author.

The Digital Library is published by the Association for Computing Machinery. Copyright © 2016 ACM, Inc.


 

No entries found

Sign In for Full Access
» Forgot Password? » Create an ACM Web Account
Article Contents: