Babelsberg/JS - A Browser-Based Implementation of an Object Constraint Language

�� � � � � � �� � ��� �� � � � � � � � � � � � � � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � � � �� � � � � � � � � � � Constraints provide a useful technique for ensuring that desired properties hold in an application. As a result, they have been used in a wide range of applications, including graphical layout, simulation, scheduling, and problem-solving. We describe the design and implementation of an Object Constraint Programming language, an object-oriented language that cleanly integrates constraints with the underlying language in a way that respects encapsulation and standard object-oriented programming techniques, and that runs in browser-based applications. Prior work on Object Constraint Programming languages has relied on modifying the underlying Virtual Machine, but that is not an option for web-based applications, which have become increasingly prominent. In this paper, we present an approach to implementing Object Constraint Programming without Virtual Machine support, along with an implementation as a JavaScript extension. We demonstrate the resulting language, Babelsberg/JS, on a number of applications and provide performance measurements. Programs without constraints in Babelsberg/JS run at the same speed as pure JavaScript versions, while programs that do have constraints can still be run efficiently. Our design and implementation also incorporate incremental re-solving to support interaction, as well as a cooperating solvers architecture that allows multiple solvers to work together to solve more difficult problems.

[1]  Alan Borning,et al.  The Programming Language Aspects of ThingLab, a Constraint-Oriented Simulation Laboratory , 1981, TOPL.

[2]  Joxan Jaffar,et al.  Constraint logic programming , 1987, POPL '87.

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

[4]  Alan Borning,et al.  Babelsberg: Specifying and Solving Constraints on Object Behavior , 2014 .

[5]  Bjørn N. Freeman-Benson,et al.  Constraints and Object Identity , 1994, ECOOP.

[6]  Alan Borning Architectures for Cooperating Constraint Solvers , 2012 .

[7]  Robert Hirschfeld,et al.  The Lively PartsBin--A Cloud-Based Repository for Collaborative Development of Active Web Content , 2012, 2012 45th Hawaii International Conference on System Sciences.

[8]  Tom Van Cutsem,et al.  Proxies: design principles for robust object-oriented intercession APIs , 2010, DLS '10.

[9]  Bjørn N. Freeman-Benson,et al.  An incremental constraint solver , 1990, CACM.

[10]  Petra Hofstedt,et al.  Turtle: A Constraint Imperative Programming Language , 2003, SGAI Conf..

[11]  Aran Lunzer,et al.  KScript and KSWorld: a time-aware and mostly declarative language and interactive GUI framework , 2013, Onward!.

[12]  Anna Philippou,et al.  Tools and Algorithms for the Construction and Analysis of Systems , 2018, Lecture Notes in Computer Science.

[13]  Emina Torlak,et al.  Kodkod: A Relational Model Finder , 2007, TACAS.

[14]  Ivan E. Sutherland,et al.  Sketchpad: a man-machine graphical communication system , 1899, AFIPS '63 (Spring).

[15]  Sukyoung Ryu,et al.  Formal specification of a JavaScript module system , 2012, OOPSLA '12.

[16]  Rajeev Alur,et al.  A Temporal Logic of Nested Calls and Returns , 2004, TACAS.

[17]  David Flanagan,et al.  The Ruby Programming Language , 2007 .

[18]  GalAndreas,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009 .

[19]  Fan Long,et al.  Automatic input rectification , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[20]  Greg Nelson,et al.  Simplification by Cooperating Decision Procedures , 1979, TOPL.

[21]  Robert Hirschfeld,et al.  Self-Sustaining Systems, First Workshop, S3 2008, Potsdam, Germany, May 15-16, 2008, Revised Selected Papers , 2008, S3.

[22]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.

[23]  Eric Rosenbaum,et al.  Scratch: programming for all , 2009, Commun. ACM.

[24]  Tommi Mikkonen,et al.  The Lively Kernel A Self-supporting System on a Web Page , 2008, S3.

[25]  Martin C. Rinard,et al.  Exploring the acceptability envelope , 2005, OOPSLA '05.

[26]  Peter J. Stuckey,et al.  The Cassowary linear arithmetic constraint solving algorithm , 2001, TCHI.

[27]  Derek Rayside,et al.  Unifying execution of imperative and declarative code , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[28]  Erica Sadun IOS Auto Layout Demystified (Mobile Programming) , 2013 .

[29]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[30]  Shriram Krishnamurthi,et al.  Flapjax: a programming language for Ajax applications , 2009, OOPSLA 2009.

[31]  Bjørn N. Freeman-Benson,et al.  Kaleidoscope: A Constraint Imperative Programming Language , 1993, NATO ASI CP.

[32]  Alan Borning,et al.  Constraint hierarchies , 1992 .