Abstract
We have developed the programming language Logic Java which smoothly integrates the object-oriented language Java and logic programming concepts such as logic variables, constraint solving, and backtracking. It combines the advantages of object-orientation such as easy maintainability and adaptability due to inheritance and encapsulation of structure and behavior with the advantages of logic languages such as suitability for search problems. Java annotations and a symbolic Java virtual machine are used to handle the logic programming concepts. In contrast to previous approaches to integrate object-oriented and logic programming, we preserve the syntax of Java. Our language is not split into two distinguishable parts but as closely integrated as possible. Besides the design and implementation of Logic Java, providing a suitable interface between conventional and logic computations is the main contribution of this paper. A killer application, which can hardly be implemented more elegantly in any other language, is the tool Muggl which systematically generates glass-box test cases for Java programs. Applications requiring a substantial amount of search are also well suited.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Aït-Kaci, H.: Warren’s abstract machine: a tutorial reconstruction. MIT Press, Cambridge (1991)
Apt, K.R.: From logic programming to Prolog. Prentice-Hall, Upper Saddle River (1996)
Armstrong, J.: The development of Erlang. In: ICFP 1997: Proceedings of the Second ACM SIGPLAN International Conference on Functional Programming, pp. 196–203. ACM, New York (1997)
Arnold, K., Gosling, J., Holmes, D.: The Java Programming Language, 4th edn. Addison-Wesley, London (2005)
Baldwin, J., Martin, T., Vargas-Vera, M.: Fril++: object-based extensions to Fril. In: Martin, T., Fontana, F. (eds.) Logic Progr. and Soft Computing, pp. 223–238. Research Studies Press, Hertfordshire (1998)
Bloch, J.: Effective Java, 2nd edn. Prentice Hall, Upper Saddle River (2008)
Cao, T.H., Rossiter, J.M., Martin, T.P., Baldwin, J.F.: On the implementation of Fril++ for object-oriented logic programming with uncertainty and fuzziness. Technologies for Constructing Intelligent Systems: Tools, 393–406 (2002)
Cimadamore, M., Viroli, M.: A Prolog-oriented extension of Java programming based on generics and annotations. In: Proceedings PPPJ 2007, pp. 197–202. ACM, New York (2007)
Cimadamore, M., Viroli, M.: Integrating Java and Prolog through generic methods and type inference. In: Proc. SAC 2008, pp. 198–205. ACM, New York (2008)
D’Hondt, M., Gybels, K., Jonckers, V.: Seamless integration of rule-based knowledge and object-oriented functionality with linguistic symbiosis. In: Proc. of the 2004 ACM SAC, SAC 2004, pp. 1328–1335. ACM, New York (2004)
Eber, J.M.: The financial crisis, a lack of contract specification tools: What can finance learn from programming language design? In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 205–206. Springer, Heidelberg (2009)
Fernandez, A.J., Hortala-Gonzalez, T., Saenz-Perez, F., Del Vado-Virseda, R.: Constraint functional logic programming over finite domains. Theory and Practice of Logic Programming 7(5), 537–582 (2007)
Gibbons, J., Oliveira, B.: The essence of the iterator pattern. J. Funct. Program. 19(3-4), 377–402 (2009)
Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java(TM) Language Specification, 3rd edn. Addison-Wesley Professional, London (2005)
Hankley, W.J.: Feature analysis of turbo prolog. SIGPLAN Not. 22, 111–118 (1987)
Hanus, M., Kuchen, H., Moreno-Navarro, J.: Curry: A Truly Functional Logic Language. In: Proceedings ILPS 1995 Workshop on Visions for the Future of Logic Programming, pp. 95–107 (1995)
Kuchen, H.: Implementing an Object Oriented Design in Curry. In: Proceedings WFLP 2000, pp. 499–509 (2000)
Lembeck, C., Caballero, R., Mueller, R.A., Kuchen, H.: Constraint solving for generating glass-box test cases. In: Proceedings WFLP 2004, pp. 19–32 (2004)
Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Prentice-Hall, Englewood Cliffs (1999)
Louden, K.C.: Programming Languages. Wadsworth, Belmont (1993)
Lusk, E., Butler, R., Disz, T., Olson, R., Overbeek, R., Stevens, R., Warren, D.H., Calderwood, A., Szeredi, P., Haridi, S., Brand, P., Carlsson, M., Ciepielewski, A., Hausman, B.: The Aurora or-parallel Prolog system. New Gen. Comput. 7(2-3), 243–271 (1990)
Majchrzak, T.A., Kuchen, H.: Automated Test Case Generation based on Coverage Analysis. In: TASE 2009: Proceedings of the 2009 3rd IEEE International Symposium on Theoretical Aspects of Software Engineering, pp. 259–266. IEEE Computer Society, Los Alamitos (2009)
Majchrzak, T.A., Kuchen, H.: Muggl: The Muenster Generator of Glass-box Test Cases. In: Becker, J., Backhaus, K., Grob, H., Hellingrath, B., Hoeren, T., Klein, S., Kuchen, H., Müller-Funk, U., Thonemann, U.W., Vossen, G. (eds.) Working Papers No. 10. European Research Center for Information Systems, ERCIS (2011)
Malenfant, J., Lapalme, G., Vaucher, J.: ObjVProlog-D: a reflexive object-oriented logic language for distributed computing. In: Proceedings OOPSLA/ECOOP 1990, pp. 78–81. ACM, New York (1991)
McCabe, F.G.: Logic and objects. Prentice-Hall, Upper Saddle River (1992)
Mens, K., Michiels, I., Wuyts, R.: Supporting software development through declaratively codified programming patterns. Expert Syst. Appl. 23(4), 405–413 (2002)
Metcalf, M., Cohen, M.: Fortran 95/2003 Explained, 3rd edn. Oxford University Press, Oxford (2004)
Morzenti, A., Pietro, P.S.: An Object-Oriented Logic Language for Modular System Specification. In: America, P. (ed.) ECOOP 1991. LNCS, vol. 512, pp. 39–58. Springer, Heidelberg (1991)
Moss, C.: Prolog++: The Power of Object-Oriented and Logic Programming, 1st edn. Addison-Wesley Longman Publishing Co., Inc., Boston (1994)
Moura, P.: From plain prolog to logtalk objects: Effective code encapsulation and reuse. In: Hill, P.M., Warren, D.S. (eds.) ICLP 2009. LNCS, vol. 5649, pp. 23–23. Springer, Heidelberg (2009)
Naftalin, M., Wadler, P.: Java Generics and Collections. O’Reilly Media, Inc., Sebastopol (2006)
Nyström, J.H.: Productivity gains with Erlang. In: Proceedings CUFP 2007. ACM, New York (2007)
Opdyke, W.F.: Refactoring object-oriented frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign, Champaign, IL, USA (1992)
Page, Jr., T.W.: An object-oriented logic programming environment for modeling. Ph.D. thesis, University of California, Los Angeles (1989)
Rémy, D.: Using, understanding, and unraveling the oCaml language from practice to theory and vice versa. In: Barthe, G., Dybjer, P., Pinto, L., Saraiva, J. (eds.) APPSEM 2000. LNCS, vol. 2395, pp. 413–536. Springer, Heidelberg (2002)
Salus, P.H.: Functional and Logic Programming Languages. Sams, Indianapolis (1998)
Scott, R.: A Guide to Artificial Intelligence with Visual Prolog. Outskirts Press (2010)
Shapiro, E.: The family of concurrent logic programming languages. ACM Computing Surveys 21(3), 413–510 (1989)
Shapiro, E.Y., Takeuchi, A.: Object Oriented Programming in Concurrent Prolog. New Generation Comput. 1(1), 25–48 (1983)
Szeredi, P.: Solving Optimisation Problems in the Aurora Or-parallel Prolog System. In: ICLP 1991: Pre-Conference Workshop on Parallel Execution of Logic Programs, pp. 39–53. Springer, London (1991)
Van Roy, P., Brand, P., Duchier, D., Haridi, S., Schulte, C., Henz, M.: Logic programming in the context of multiparadigm, programming: the Oz experience. Theory and Practice of Logic Programming 3(6), 717–763 (2003)
Warren, D.H.D., Pereira, L.M., Pereira, F.: Prolog – the language and its implementation compared with Lisp. In: Proceedings of the 1977 Symposium on Artificial Intelligence and Programming Languages, pp. 109–115. ACM, New York (1977)
Wiger, U.: 20 years of industrial functional programming. In: ICFP 2004: Proceedings of the Ninth ACM SIGPLAN International Conference on Functional Programming, pp. 162–162. ACM, New York (2004)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Majchrzak, T.A., Kuchen, H. (2011). Logic Java: Combining Object-Oriented and Logic Programming. In: Kuchen, H. (eds) Functional and Constraint Logic Programming. WFLP 2011. Lecture Notes in Computer Science, vol 6816. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-22531-4_8
Download citation
DOI: https://doi.org/10.1007/978-3-642-22531-4_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-22530-7
Online ISBN: 978-3-642-22531-4
eBook Packages: Computer ScienceComputer Science (R0)