Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Ingalls, D., Palacz, K., Uhler, S., Taivalsaari, A., Mikkonen, T.: The lively kernel A self-supporting system on a web page. In: Hirschfeld, R., Rose, K. (eds.) S3 2008. LNCS, vol. 5146, pp. 31–50. Springer, Heidelberg (2008)
Lincke, J., Krahn, R., Ingalls, D., Roder, M., Hirschfeld, R.: The Lively PartsBin–a cloud-based repository for collaborative development of active web content. In: 2012 45th Hawaii International Conference on System Science (HICSS 2012), pp. 693–701. IEEE (2012)
Sutherland, I.: Sketchpad: A man-machine graphical communication system. In: Proceedings of the Spring Joint Computer Conference, IFIPS, pp. 329–346 (1963)
Borning, A.: The programming language aspects of ThingLab, a constraint-oriented simulation laboratory. ACM Transactions on Programming Languages and Systems 3(4), 353–387 (1981)
Felgentreff, T., Borning, A., Hirschfeld, R.: Babelsberg: Specifying and solving constraints on object behavior. Technical Report 81, Hasso-Plattner-Institut, Potsdam, Germany (May 2014)
Lopez, G., Freeman-Benson, B., Borning, A.: Kaleidoscope: A constraint imperative programming language. In: Constraint Programming. NATO Advanced Science Institute Series, Series F: Computer and System Sciences, vol. 131, pp. 313–329. Springer (1994)
Grabmüller, M., Hofstedt, P.: Turtle: A constraint imperative programming language. In: Research and Development in Intelligent Systems XX, pp. 185–198. Springer (2004)
Badros, G.J., Borning, A., Stuckey, P.J.: The Cassowary linear arithmetic constraint solving algorithm. ACM Transactions on Computer-Human Interaction (TOCHI) 8(4), 267–306 (2001)
De Moura, L., Bjørner, N.: Z3: An efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)
Torlak, E., Jackson, D.: Kodkod: A relational model finder. In: Grumberg, O., Huth, M. (eds.) TACAS 2007. LNCS, vol. 4424, pp. 632–647. Springer, Heidelberg (2007)
Sadun, E.: iOS Auto Layout Demystified. Addison-Wesley (October 2013)
Enthought Inc: Enaml 0.6.3 documentation (February 2014)
Ohshima, Y., Lunzer, A., Freudenberg, B., Kaehler, T.: KScript and KSWorld: A time-aware and mostly declarative language and interactive GUI framework. In: Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software, Onward! 2013, pp. 117–134. ACM, New York (2013)
Meyerovich, L.A., Guha, A., Baskin, J., Cooper, G.H., Greenberg, M., Bromfield, A., Krishnamurthi, S.: Flapjax: A programming language for Ajax applications. ACM SIGPLAN Notices 44(10), 1–20 (2009)
Flanagan, D., Matsumoto, Y.: The Ruby Programming Language. O’Reilly (January 2008)
Freeman-Benson, B.N., Maloney, J., Borning, A.: An incremental constraint solver. Communications of the ACM 33(1), 54–63 (1990)
Rinard, M., Cadar, C., Nguyen, H.H.: Exploring the acceptability envelope. In: Companion to the 20th Annual ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA 2005), pp. 21–30. ACM (October 2005)
Milicevic, A., Rayside, D., Yessenov, K., Jackson, D.: Unifying execution of imperative and declarative code. In: 33rd International Conference on Software Engineering (ICSE), pp. 511–520 (May 2011)
Resnick, M., Maloney, J., Monroy-Hernández, A., Rusk, N., Eastmond, E., Brennan, K., Millner, A., Rosenbaum, E., Silver, J., Silverman, B., et al.: Scratch: programming for all. Communications of the ACM 52(11), 60–67 (2009)
Jaffar, J., Lassez, J.L.: Constraint logic programming. In: Proceedings of the 14th ACM Principles of Programming Languages Conference (POPL 1987), pp. 111–119. ACM (January 1987)
Borning, A., Freeman-Benson, B., Wilson, M.: Constraint hierarchies. LISP and Symbolic Computation 5(3), 223–270 (1992)
Van Cutsem, T., Miller, M.S.: Proxies: Design principles for robust object-oriented intercession APIs. ACM Sigplan Notices 45(12), 59–72 (2010)
Kang, S., Ryu, S.: Formal specification of a JavaScript module system. In: Proceedings of the ACM International Conference on Object-Oriented Programming Systems Languages and Applications, pp. 621–638. ACM (2012)
Borning, A.: Architectures for cooperating constraint solvers. Technical Report VPRI Memo M-2012-003, Viewpoints Research Institute, Glendale, California (May 2012)
Nelson, G., Oppen, D.: Simplification by cooperating decision procedures. ACM Transactions on Programming Languages and Systems 1, 245–257 (1979)
Long, F., Ganesh, V., Carbin, M., Sidiroglou, S., Rinard, M.: Automatic input rectification. In: 2012 34th International Conference on Software Engineering (ICSE), pp. 80–90. IEEE (2012)
Gal, A., Eich, B., Shaver, M., Anderson, D., Mandelin, D., Haghighat, M.R., Kaplan, B., Hoare, G., Zbarsky, B., Orendorff, J., et al.: Trace-based just-in-time type specialization for dynamic languages. ACM Sigplan Notices 44(6), 465–478 (2009)
Lopez, G., Freeman-Benson, B., Borning, A.: Kaleidoscope: A constraint imperative programming language. In: Constraint Programming. NATO Advanced Science Institute Series, Series F: Computer and System Sciences, vol. 131, pp. 313–329. Springer (1994)
Lopez, G., Freeman-Benson, B., Borning, A.: Constraints and object identity. In: Pareschi, R. (ed.) ECOOP 1994. LNCS, vol. 821, pp. 260–279. Springer, Heidelberg (1994)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
1 Electronic Supplementary Material
Rights and permissions
Copyright information
© 2014 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Felgentreff, T. et al. (2014). Babelsberg/JS. In: Jones, R. (eds) ECOOP 2014 – Object-Oriented Programming. ECOOP 2014. Lecture Notes in Computer Science, vol 8586. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-44202-9_17
Download citation
DOI: https://doi.org/10.1007/978-3-662-44202-9_17
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-44201-2
Online ISBN: 978-3-662-44202-9
eBook Packages: Computer ScienceComputer Science (R0)