Logic Java: Combining Object-Oriented and Logic Programming

  • Tim A. Majchrzak
  • Herbert Kuchen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6816)

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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aït-Kaci, H.: Warren’s abstract machine: a tutorial reconstruction. MIT Press, Cambridge (1991)Google Scholar
  2. 2.
    Apt, K.R.: From logic programming to Prolog. Prentice-Hall, Upper Saddle River (1996)Google Scholar
  3. 3.
    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)CrossRefGoogle Scholar
  4. 4.
    Arnold, K., Gosling, J., Holmes, D.: The Java Programming Language, 4th edn. Addison-Wesley, London (2005)MATHGoogle Scholar
  5. 5.
    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)Google Scholar
  6. 6.
    Bloch, J.: Effective Java, 2nd edn. Prentice Hall, Upper Saddle River (2008)Google Scholar
  7. 7.
    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)Google Scholar
  8. 8.
    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)Google Scholar
  9. 9.
    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)Google Scholar
  10. 10.
    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)Google Scholar
  11. 11.
    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)CrossRefGoogle Scholar
  12. 12.
    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)MathSciNetCrossRefMATHGoogle Scholar
  13. 13.
    Gibbons, J., Oliveira, B.: The essence of the iterator pattern. J. Funct. Program. 19(3-4), 377–402 (2009)MathSciNetCrossRefMATHGoogle Scholar
  14. 14.
    Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java(TM) Language Specification, 3rd edn. Addison-Wesley Professional, London (2005)MATHGoogle Scholar
  15. 15.
    Hankley, W.J.: Feature analysis of turbo prolog. SIGPLAN Not. 22, 111–118 (1987)CrossRefGoogle Scholar
  16. 16.
    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)Google Scholar
  17. 17.
    Kuchen, H.: Implementing an Object Oriented Design in Curry. In: Proceedings WFLP 2000, pp. 499–509 (2000)Google Scholar
  18. 18.
    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)Google Scholar
  19. 19.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Prentice-Hall, Englewood Cliffs (1999)Google Scholar
  20. 20.
    Louden, K.C.: Programming Languages. Wadsworth, Belmont (1993)MATHGoogle Scholar
  21. 21.
    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)CrossRefGoogle Scholar
  22. 22.
    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)CrossRefGoogle Scholar
  23. 23.
    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)Google Scholar
  24. 24.
    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)Google Scholar
  25. 25.
    McCabe, F.G.: Logic and objects. Prentice-Hall, Upper Saddle River (1992)MATHGoogle Scholar
  26. 26.
    Mens, K., Michiels, I., Wuyts, R.: Supporting software development through declaratively codified programming patterns. Expert Syst. Appl. 23(4), 405–413 (2002)CrossRefGoogle Scholar
  27. 27.
    Metcalf, M., Cohen, M.: Fortran 95/2003 Explained, 3rd edn. Oxford University Press, Oxford (2004)MATHGoogle Scholar
  28. 28.
    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)CrossRefGoogle Scholar
  29. 29.
    Moss, C.: Prolog++: The Power of Object-Oriented and Logic Programming, 1st edn. Addison-Wesley Longman Publishing Co., Inc., Boston (1994)Google Scholar
  30. 30.
    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)CrossRefGoogle Scholar
  31. 31.
    Naftalin, M., Wadler, P.: Java Generics and Collections. O’Reilly Media, Inc., Sebastopol (2006)Google Scholar
  32. 32.
    Nyström, J.H.: Productivity gains with Erlang. In: Proceedings CUFP 2007. ACM, New York (2007)Google Scholar
  33. 33.
    Opdyke, W.F.: Refactoring object-oriented frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign, Champaign, IL, USA (1992)Google Scholar
  34. 34.
    Page, Jr., T.W.: An object-oriented logic programming environment for modeling. Ph.D. thesis, University of California, Los Angeles (1989)Google Scholar
  35. 35.
    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)CrossRefGoogle Scholar
  36. 36.
    Salus, P.H.: Functional and Logic Programming Languages. Sams, Indianapolis (1998)Google Scholar
  37. 37.
    Scott, R.: A Guide to Artificial Intelligence with Visual Prolog. Outskirts Press (2010)Google Scholar
  38. 38.
    Shapiro, E.: The family of concurrent logic programming languages. ACM Computing Surveys 21(3), 413–510 (1989)CrossRefGoogle Scholar
  39. 39.
    Shapiro, E.Y., Takeuchi, A.: Object Oriented Programming in Concurrent Prolog. New Generation Comput. 1(1), 25–48 (1983)CrossRefGoogle Scholar
  40. 40.
    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)Google Scholar
  41. 41.
    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)CrossRefMATHGoogle Scholar
  42. 42.
    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)CrossRefGoogle Scholar
  43. 43.
    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)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Tim A. Majchrzak
    • 1
  • Herbert Kuchen
    • 1
  1. 1.Department of Information SystemsUniversity of MünsterMünsterGermany

Personalised recommendations