ABSTRACT
Object-constraint programming systems integrate declarative constraint solving with imperative, object-oriented languages, seamlessly providing the power of both paradigms. However, experience with object-constraint systems has shown that giving too much power to the constraint solver opens up the potential for solutions that are surprising and unintended as well as for complex interactions between constraints and imperative code. On the other hand, systems that overly limit the power of the solver, for example by disallowing constraints involving mutable objects, object identity, or polymorphic message sends, run the risk of excluding the core object-oriented features of the language from the constraint part, and consequently not being able to express declaratively a large set of interesting problem solutions. In this paper we present design principles that tame the power of the constraint solver in object-constraint languages to avoid difficult corner cases and surprising solutions while retaining the key features of the approach, including constraints over mutable objects, constraints involving object identity, and constraints on the results of message sends. We present our solution concretely in the context of the Babelsberg object-constraint language framework, providing both an informal description of the resulting language and a formal semantics for a core subset of it. We validate the utility of this semantics with an executable version that allows us to run test programs and to verify that they provide the same results as existing implementations of Babelsberg in JavaScript, Ruby, and Smalltalk.
Supplemental Material
Available for Download
This artifact has been evaluated through the OOPSLA AEC process. It contains an OVA container which is just a ZIP file and some meta information for a virtual machine. It should be compatible with VirtualBox and VMware virtualization software. It also contains a PDF description of the artifact, which is also included in the virtual machine, and which describes the artifact in detail.
- N. Björner and A.-D. Phan. νZ–maximal satisfaction with Z3. In Symbolic Computation in Software Science, 2014.Google Scholar
- A. Borning, B. Freeman-Benson, and M. Wilson. Constraint hierarchies. LISP and Symbolic Computation, 5(3):223–270, 1992. Google ScholarDigital Library
- L. De Moura and N. Bjørner. Z3: An efficient SMT solver. In TACAS, pages 337–340. Springer, 2008. Google ScholarDigital Library
- T. Felgentreff, A. Borning, and R. Hirschfeld. Specifying and solving constraints on object behavior. Journal of Object Technology, 13(4):1–38, 2014.Google ScholarCross Ref
- T. Felgentreff, A. Borning, R. Hirschfeld, J. Lincke, Y. Ohshima, B. Freudenberg, and R. Krahn. Babelsberg/JS: A browser-based implementation of an object constraint language. In ECOOP, pages 411–436. Springer, 2014.Google Scholar
- T. Felgentreff, T. Millstein, and A. Borning. Developing a formal semantics for Babelsberg: A step-by-step approach. Technical Report 2014-002b, Viewpoints Research Institute, 2015. Available at http://www.vpri.org/pdf/ tr2014002_babelsberg.pdf.Google Scholar
- T. Felgentreff, T. Millstein, A. Borning, and R. Hirschfeld. Checks and balances — constraint solving without surprises in object-constraint programming languages: Full formal development. Technical Report 2015-001, Viewpoints Research Institute, 2015.Google Scholar
- B. Freeman-Benson and A. Borning. Integrating constraints with an object-oriented language. In ECOOP, pages 268–286, June 1992. Google ScholarDigital Library
- B. N. Freeman-Benson, J. Maloney, and A. Borning. An incremental constraint solver. Communications of the ACM, 33(1):54–63, 1990. Google ScholarDigital Library
- M. Graber, T. Felgentreff, R. Hirschfeld, and A. Borning. Solving interactive logic puzzles with object-constraints — an experience report using Babelsberg/S for Squeak/Smalltalk. In Workshop on Reactive and Event-based Languages & Systems, 2014.Google Scholar
- M. Grabmüller and P. Hofstedt. Turtle: A constraint imperative programming language. In RDIS, pages 185–198. Springer, 2004.Google Scholar
- D. Jackson. Alloy: A lightweight object modelling notation. ACM Transactions on Software Engineering and Methodology, 11(2):256–290, 2002. Google ScholarDigital Library
- J. Jaffar and J.-L. Lassez. Constraint logic programming. In POPL, pages 111–119. ACM, 1987. Google ScholarDigital Library
- A. S. Köksal, V. Kuncak, and P. Suter. Constraints as control. In POPL, pages 151–164. ACM, 2012. Google ScholarDigital Library
- G. Lopez, B. Freeman-Benson, and A. Borning. Constraints and object identity. In ECOOP, pages 260–279. Springer, 1994. Google ScholarDigital Library
- G. Lopez, B. Freeman-Benson, and A. Borning. Kaleidoscope: A constraint imperative programming language. In Constraint Programming, volume 131 of NATO ASI Series, Series F: Computer and System Sciences, pages 313–329. Springer, 1994.Google Scholar
- A. Milicevic, D. Rayside, K. Yessenov, and D. Jackson. Unifying execution of imperative and declarative code. In ICSE, pages 511–520. ACM/IEEE, 2011. Google ScholarDigital Library
- A. Milicevic, I. Efrati, and D. Jackson. αRby–an embedding of Alloy in Ruby. In Abstract State Machines, Alloy, B, TLA, VDM, and Z, volume 8477 of Lecture Notes in Computer Science, pages 56–71. Springer, 2014.Google Scholar
- F. Pachet and P. Roy. Integrating constraint satisfaction techniques with complex object structures. In Conference of the British Computer Society Specialist Group on Expert Systems, pages 11–22. Cambridge University Press, 1995.Google Scholar
- M. Pettersson. RML—a new language and implementation for natural semantics. In PLILP, pages 117–131. Springer, 1994. Google ScholarDigital Library
- P. Roy, A. Liret, and F. Pachet. A framework for objectoriented constraint satisfaction problems. In Computing Surveys Symposium on Object-Oriented Application Frameworks, pages 1–22. ACM, 2000.Google Scholar
- P. Van Roy, P. Brand, D. Duchier, S. Haridi, C. Schulte, and M. Henz. Logic programming in the context of multiparadigm programming: The Oz experience. Theory and Practice of Logic Programming, 3(06):717–763, 2003. Google ScholarDigital Library
- Y. Zheng, X. Zhang, and V. Ganesh. Z3-str: A Z3-based string solver for web application analysis. In ESEC/FSE, pages 114– 124. ACM, 2013. Google ScholarDigital Library
Index Terms
Checks and balances: constraint solving without surprises in object-constraint programming languages
Recommendations
Checks and balances: constraint solving without surprises in object-constraint programming languages
OOPSLA '15Object-constraint programming systems integrate declarative constraint solving with imperative, object-oriented languages, seamlessly providing the power of both paradigms. However, experience with object-constraint systems has shown that giving too ...
Automatically selecting and optimizing constraint solver procedures for object-constraint languages
MODULARITY Companion 2016: Companion Proceedings of the 15th International Conference on ModularityObject-constraint programming provides a design to integrate constraints with dynamic, object-oriented programming languages. It allows developers to encode multi-way constraints over objects and object collections using existing, object-oriented ...
Implementing constraint imperative programming languages: the Kaleidoscope'93 virtual machine
OOPSLA '94: Proceedings of the ninth annual conference on Object-oriented programming systems, language, and applicationsConstraint Imperative Programming (CIP) languages integrate declarative constraints with imperative state and destructive assignment, yielding a powerful new programming paradigm. However, CIP languages are difficult to implement efficiently due to ...
Comments