skip to main content
10.1145/1411318.1411320acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

A functional model-view-controller software architecture for command-oriented programs

Published:20 September 2008Publication History

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.

References

  1. 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 ScholarGoogle Scholar
  2. 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 ScholarGoogle Scholar
  3. Apple. Apple Developer Connection Reference Library: The Model-View-Controller Design Pattern. Apple Computer, Inc., 2006.Google ScholarGoogle Scholar
  4. CWB-NC. CWB-NC: Concurrency Workbench of the New Century. http://www.cs.sunysb.edu/~cwb/, 2000.Google ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. E. R. Gansner and J. H. Reppy, editors. The Standard ML Basis Library. Cambridge University Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. Garrigue. LablGTK: an objective caml interface to GTK+. http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html, 2006.Google ScholarGoogle Scholar
  9. GTK. The GTK+ multi-platform toolkit for creating graphical user-interfaces. http://www.gtk.org, 2007.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. X. Leroy. The objective caml system. www.ocaml.org, 2005.Google ScholarGoogle Scholar
  13. D. Libes. Expect: Scripts for controlling interactive programs. Computing Systems, 4(2):99--126, 1991.Google ScholarGoogle Scholar
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle Scholar
  16. J. K. Ousterhout. Tcl and the Tk Toolkit. Addison-Wesley, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle Scholar
  19. J. H. Reppy. Concurrent Programming in ML. Cambridge University Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A functional model-view-controller software architecture for command-oriented programs

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        WGP '08: Proceedings of the ACM SIGPLAN workshop on Generic programming
        September 2008
        80 pages
        ISBN:9781605580609
        DOI:10.1145/1411318

        Copyright © 2008 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 20 September 2008

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        WGP '08 Paper Acceptance Rate6of10submissions,60%Overall Acceptance Rate30of43submissions,70%

        Upcoming Conference

        ICFP '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader