Generating reactive programs for graphical user interfaces from multi-way dataflow constraint systems

For a GUI to remain responsive, it must be able to schedule lengthy tasks to be executed asynchronously. In the traditional approach to GUI implementation--writing functions to handle individual user events--asynchronous programming easily leads to defects. Ensuring that all data dependencies are respected is difficult when new events arrive while prior events are still being handled. Reactive programming techniques, gaining popularity in GUI programming, help since they make data dependencies explicit and enforce them automatically as variables' values change. However, data dependencies in GUIs usually change along with its state. Reactive programming must therefore describe a GUI as a collection of many reactive programs, whose interaction the programmer must explicitly coordinate. This paper presents a declarative approach for GUI programming that relieves the programmer from coordinating asynchronous computations. The approach is based on our prior work on "property models", where GUI state is maintained by a dataflow constraint system. A property model responds to user events by atomically constructing new data dependencies and scheduling asynchronous computations to enforce those dependencies. In essence, a property model dynamically generates a reactive program, adding to it as new events occur. The approach gives the following guarantee: the same sequence of events produces the same results, regardless of the timing of those events.

[1]  Meurig Sage FranTk - a declarative GUI language for Haskell , 2000, ICFP '00.

[2]  Paul Hudak,et al.  Functional reactive programming from first principles , 2000, PLDI '00.

[3]  Magne Haveraaen,et al.  Specializing planners for hierarchical multi-way dataflow constraint systems , 2014, GPCE.

[4]  Paul Hudak,et al.  Functional reactive animation , 1997, ICFP '97.

[5]  Rob Miller,et al.  The Amulet Environment: New Models for Effective User Interface Software Development , 1997, IEEE Trans. Software Eng..

[6]  Roger B. Dannenberg,et al.  Garnet: comprehensive support for graphical, highly interactive user interfaces , 1990, Computer.

[7]  Brad A. Myers Separating application code from toolkits: eliminating the spaghetti of call-backs , 1991, UIST '91.

[8]  E KrasnerGlenn,et al.  A cookbook for using the model-view controller user interface paradigm in Smalltalk-80 , 1988 .

[9]  Michael Sannella Skyblue: a multi-way local propagation constraint solver for user interface construction , 1994, UIST '94.

[10]  John Freeman,et al.  Algorithms for user interfaces , 2009, GPCE '09.

[11]  Antony Courtney,et al.  Genuinely Functional User Interfaces , 2001 .

[12]  Liuba Shrira,et al.  Promises: linguistic support for efficient asynchronous procedure calls in distributed systems , 1988, PLDI '88.

[13]  Henrik Nilsson,et al.  The Yampa arcade , 2003, Haskell '03.

[14]  Brad A. Myers,et al.  ConstraintJS: programming interactive behaviors for the web by integrating constraints and states , 2012, UIST '12.

[15]  Antony Courtney,et al.  Frappé: Functional Reactive Programming in Java , 2001, PADL.

[16]  Alan Borning,et al.  Specifying and Solving Constraints on Object Behavior , 2014, J. Object Technol..

[17]  Gilles Trombettoni,et al.  Computational Complexity of Multi-way, Dataflow Constraint Problems , 1997, IJCAI.

[18]  Bradley T. Vander Zanden,et al.  An incremental algorithm for satisfying hierarchies of multiway dataflow constraints , 1996, TOPL.

[19]  Bjørn N. Freeman-Benson,et al.  Constraint hierarchies , 1987, OOPSLA '87.

[20]  John Peterson,et al.  Parallel Functional Reactive Programming , 2000, PADL.

[21]  Alan Borning,et al.  Multi-Garnet: Integrating Multi-Way Constraints with Garnet , 1992 .

[22]  John Freeman,et al.  Property models: from incidental algorithms to reusable components , 2008, GPCE '08.