A Functional Model-View-Controller Software Architecture for Command-oriented Programs

December 2, 2010
2:50 pm - 4:00 pm
Halligan 111

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, I propose a software architecture for such programs called 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 computations of the model can monitored and aborted by view. I will illustrate the approach with a case study of a complete program, written in Standard ML, and using Concurrent ML and the eXene X window system toolkit.