skip to main content
research-article

Checks and balances: constraint solving without surprises in object-constraint programming languages

Published:23 October 2015Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

References

  1. N. Björner and A.-D. Phan. νZ–maximal satisfaction with Z3. In Symbolic Computation in Software Science, 2014.Google ScholarGoogle Scholar
  2. A. Borning, B. Freeman-Benson, and M. Wilson. Constraint hierarchies. LISP and Symbolic Computation, 5(3):223–270, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. L. De Moura and N. Bjørner. Z3: An efficient SMT solver. In TACAS, pages 337–340. Springer, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. T. Felgentreff, A. Borning, and R. Hirschfeld. Specifying and solving constraints on object behavior. Journal of Object Technology, 13(4):1–38, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle Scholar
  7. 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 ScholarGoogle Scholar
  8. B. Freeman-Benson and A. Borning. Integrating constraints with an object-oriented language. In ECOOP, pages 268–286, June 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. B. N. Freeman-Benson, J. Maloney, and A. Borning. An incremental constraint solver. Communications of the ACM, 33(1):54–63, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle Scholar
  11. M. Grabmüller and P. Hofstedt. Turtle: A constraint imperative programming language. In RDIS, pages 185–198. Springer, 2004.Google ScholarGoogle Scholar
  12. D. Jackson. Alloy: A lightweight object modelling notation. ACM Transactions on Software Engineering and Methodology, 11(2):256–290, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J. Jaffar and J.-L. Lassez. Constraint logic programming. In POPL, pages 111–119. ACM, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. S. Köksal, V. Kuncak, and P. Suter. Constraints as control. In POPL, pages 151–164. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Lopez, B. Freeman-Benson, and A. Borning. Constraints and object identity. In ECOOP, pages 260–279. Springer, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle Scholar
  19. 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 ScholarGoogle Scholar
  20. M. Pettersson. RML—a new language and implementation for natural semantics. In PLILP, pages 117–131. Springer, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle Scholar
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Checks and balances: constraint solving without surprises in object-constraint programming languages

    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

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!