Skip to main content

Improving Prolog Programs: Refactoring for Prolog

  • Conference paper
Book cover Logic Programming (ICLP 2004)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 3132))

Included in the following conference series:

Abstract

Refactoring is an established technique from the OO-community to restructure code: it aims at improving software readability, maintainability and extensibility. Although refactoring is not tied to the OO-paradigm in particular, its ideas have not been applied to Logic Programming until now.

This paper applies the ideas of refactoring to Prolog programs. A catalogue is presented listing refactorings classified according to scope. Some of the refactorings have been adapted from the OO-paradigm, while others have been specifically designed for Prolog. Also the discrepancy between intended and operational semantics in Prolog is addressed by some of the refactorings.

In addition, ViPReSS, a semi-automatic refactoring browser, is discussed and the experience with applying ViPReSS to a large Prolog legacy system is reported. Our main conclusion is that refactoring is not only a viable technique in Prolog but also a rather desirable one.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. The -> operator. Association for Logic Programming Newsletter 4(2), 10–12 (1991)

    Google Scholar 

  2. Information technology–Programming languages–Prolog–Part 1: General core. ISO/IEC, ISO/IEC 13211-1:1995 (1995)

    Google Scholar 

  3. Deville, Y.: Logic Programming: Systematic program development. Addison-Wesley, Reading (1990)

    Google Scholar 

  4. Etalle, S., Gabbrielli, M., Meo, M.C.: Transformations of CCP programs. ACM Transactions on Programming Languages and Systems 23(3), 304–395 (2001)

    Article  Google Scholar 

  5. Fowler, M.: Refactorings in alphabetical order (2003), Available at http://www.refactoring.com/catalog/

  6. Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: Refactoring: improving the design of existing code. Object Technology Series. Addison-Wesley, Reading (1999)

    Google Scholar 

  7. Intelligent Systems Laboratory. SICStus Prolog User’s Manual. PO Box 1263, SE-164 29 Kista, Sweden (October 2003)

    Google Scholar 

  8. Masters, I.T.: MasterProLog Programming Environment (2000), http://www.itmasters.com

  9. Jacobs, N., Blockeel, H.: The learning shell: Automated macro construction. In: Bauer, M., Gmytrasiewicz, P.J., Vassileva, J. (eds.) UM 2001. LNCS (LNAI), vol. 2109, pp. 34–43. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  10. Leuschel, M., Sørensen, M.H.: Redundant argument filtering of logic programs. In: Gallagher, J.P. (ed.) LOPSTR 1996. LNCS, vol. 1207, pp. 83–103. Springer, Heidelberg (1997)

    Google Scholar 

  11. Li, H., Reinke, C., Thompson, S.: Tool support for refactoring functional programs. In: Jeuring, J. (ed.) Haskell Workshop 2003, Association for Computing Machinery (2003)

    Google Scholar 

  12. O’Keefe, R.A.: The Craft of Prolog. MIT Press, Cambridge (1994)

    Google Scholar 

  13. Opdyke, W.F.: Refactoring object-oriented frameworks. PhD thesis, University of Illinois at Urbana-Champaign (1992)

    Google Scholar 

  14. Pettorossi, A., Proietti, M.: Transformation of logic programs: Foundations and techniques. Journal of Logic Programming 19/20, 261–320 (1994)

    Article  MathSciNet  Google Scholar 

  15. Roberts, D., Brant, J., Johnson, R.: A refactoring tool for Smalltalk. Theory and Practice of Object Systems (TAPOS) 3(4), 253–263 (1997)

    Article  Google Scholar 

  16. Schrijvers, T., Serebrenik, A., Demoen, B.: Refactoring Prolog programs. Technical Report CW373, Department of Computerscience, K.U.Leuven (December 2003)

    Google Scholar 

  17. Seipel, D., Hopfner, M., Heumesser, B.: Analysing and visualizing Prolog programs based on XML representations. In: Mesnard, F., Serebrenik, A. (eds.) Proceedings of the 13th International Workshop on Logic Programming Environments, pp. 31–45 (2003); Published as technical report CW371 of Katholieke Universiteit Leuven.

    Google Scholar 

  18. Serebrenik, A., Demoen, B.: Refactoring logic programs. Poster. In: Ninetheenth International Conference on Logic Programming, Mumbay, India, December 9-13 (2003)

    Google Scholar 

  19. Somogyi, Z., Henderson, F., Conway, T.: Mercury: an efficient purely declarative logic programming language. In: Australian Computer Science Conference

    Google Scholar 

  20. Tarau, P.: Fluents: A refactoring of Prolog for uniform reflection an interoperation with external objects. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1225–1239. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  21. Tourwé, T., Mens, T.: Identifying refactoring opportunities using logic meta programming. In: 7th European Conference on Software Maintenance and Reengineering, Proceedings, pp. 91–100. IEEE Computer Society, Los Alamitos (2003)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Schrijvers, T., Serebrenik, A. (2004). Improving Prolog Programs: Refactoring for Prolog. In: Demoen, B., Lifschitz, V. (eds) Logic Programming. ICLP 2004. Lecture Notes in Computer Science, vol 3132. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-27775-0_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-27775-0_5

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-22671-0

  • Online ISBN: 978-3-540-27775-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics