ABSTRACT
Command-oriented functional programs are currently structured in an ad hoc way that makes the development of multiple user-interfaces difficult and error prone, and makes it difficult to abstractly understand a program's command-oriented behavior. To rectify this, we propose a software architecture for such programs that we call functional model-view-controller (MVC), by a rough analogy with object-oriented MVC. In functional MVC, a program is structured as a model (domain-specific aspects), view (abstract user) and controller (command loops). In contrast to object-oriented MVC, a controller is active, consisting of a number of recursive functions. It calls its view to get user input and to display results to the user; it calls its model to do domain-specific work. To increase adaptability, a controller should be parameterized by its model and view, using a function or an ML-style functor. With this approach, one can write terminal and graphical views; one can also write views that do abstract scripting. One can understand and reason about a program's command-oriented aspects at a high-level of abstraction by focusing on the controller. Of particular note is the way we are able to allow computations of the model to be monitored and aborted by view. We illustrate our approach with a case study of a complete program, written in Standard ML, and using Concurrent ML and the eXene X window system toolkit.
- P. Achten, M. van Eekelen, and R. Plasmeijer. Compositional model-views with generic graphical user interfaces. In Practical Aspects of Declarative Programming, PADL04, volume 3057 of Lecture Notes in Computer Science, pages 39--55. Springer-Verlag, 2004.Google Scholar
- A. Appel, M. Blume, E. Gansner, L. George, L. Huelsbergen, D. MacQueen, J. Reppy, and Z. Shao. Standard ML of New Jersey. www.smlnj.org, 2007.Google Scholar
- Apple. Apple Developer Connection Reference Library: The Model-View-Controller Design Pattern. Apple Computer, Inc., 2006.Google Scholar
- CWB-NC. CWB-NC: Concurrency Workbench of the New Century. http://www.cs.sunysb.edu/~cwb/, 2000.Google Scholar
- Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation, pages 236--248, 1998. Google ScholarDigital Library
- E. R. Gansner and J. H. Reppy, editors. The Standard ML Basis Library. Cambridge University Press, 2002. Google ScholarDigital Library
- E. R. Gansner and J. H. Reppy. A multi-threaded higher-order user interface toolkit. In Bass and Dewan, editors, User Interface Software, volume 1 of Software Trends. Wiley, 1993. Google ScholarDigital Library
- J. Garrigue. LablGTK: an objective caml interface to GTK+. http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html, 2006.Google Scholar
- GTK. The GTK+ multi-platform toolkit for creating graphical user-interfaces. http://www.gtk.org, 2007.Google Scholar
- G. Krasner and S. Pope. A description of the model-view-controller user interface paradigm in the Smalltalk-80 system. Journal of Object Oriented Programming, 1(3):26--49, 1988. Google ScholarDigital Library
- Ken Friis Larsen and Henning Niss. mGTK: an SML binding of Gtk+. In USENIX'04: Proceedings of the 2004 USENIX Annual Technical Conference, pages 46--46, Berkeley, CA, USA, 2004. USENIX Association. Google ScholarDigital Library
- X. Leroy. The objective caml system. www.ocaml.org, 2005.Google Scholar
- D. Libes. Expect: Scripts for controlling interactive programs. Computing Systems, 4(2):99--126, 1991.Google Scholar
- C. Lüth and B. Wolff. Functional design and implementation of graphical user interfaces for theorem provers. Journal of Functional Programming, 9(2):167--189, March 1999. Google ScholarDigital Library
- C. Lüth, S. Westmeier, and B. Wolff. sml_tk: Functional programming for graphical user interfaces. Technical Report 8/96, FB 3, Universität Bremen, 1996.Google Scholar
- J. K. Ousterhout. Tcl and the Tk Toolkit. Addison-Wesley, 1994. Google ScholarDigital Library
- F. Pfenning and C. Schürmann. System description: Twelf - A meta-logical framework for deductive systems. In H. Ganzinger, editor, Proceedings of the 16th International Conference on Automated Deduction (CADE-16), pages 202--206, Trento, Italy, 1999. Springer-Verlag LNAI 1632. Google ScholarDigital Library
- B. C. Pierce, S. Balasubramaniam, and J. Vouillon. The unison file synchronizer. http://www.cis.upenn.edu/~bcpierce/unison/, 2004. Version 2.13.15.Google Scholar
- J. H. Reppy. Concurrent Programming in ML. Cambridge University Press, 1999. Google ScholarDigital Library
Index Terms
- A functional model-view-controller software architecture for command-oriented programs
Comments