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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
The -> operator. Association for Logic Programming Newsletter 4(2), 10–12 (1991)
Information technology–Programming languages–Prolog–Part 1: General core. ISO/IEC, ISO/IEC 13211-1:1995 (1995)
Deville, Y.: Logic Programming: Systematic program development. Addison-Wesley, Reading (1990)
Etalle, S., Gabbrielli, M., Meo, M.C.: Transformations of CCP programs. ACM Transactions on Programming Languages and Systems 23(3), 304–395 (2001)
Fowler, M.: Refactorings in alphabetical order (2003), Available at http://www.refactoring.com/catalog/
Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: Refactoring: improving the design of existing code. Object Technology Series. Addison-Wesley, Reading (1999)
Intelligent Systems Laboratory. SICStus Prolog User’s Manual. PO Box 1263, SE-164 29 Kista, Sweden (October 2003)
Masters, I.T.: MasterProLog Programming Environment (2000), http://www.itmasters.com
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)
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)
Li, H., Reinke, C., Thompson, S.: Tool support for refactoring functional programs. In: Jeuring, J. (ed.) Haskell Workshop 2003, Association for Computing Machinery (2003)
O’Keefe, R.A.: The Craft of Prolog. MIT Press, Cambridge (1994)
Opdyke, W.F.: Refactoring object-oriented frameworks. PhD thesis, University of Illinois at Urbana-Champaign (1992)
Pettorossi, A., Proietti, M.: Transformation of logic programs: Foundations and techniques. Journal of Logic Programming 19/20, 261–320 (1994)
Roberts, D., Brant, J., Johnson, R.: A refactoring tool for Smalltalk. Theory and Practice of Object Systems (TAPOS) 3(4), 253–263 (1997)
Schrijvers, T., Serebrenik, A., Demoen, B.: Refactoring Prolog programs. Technical Report CW373, Department of Computerscience, K.U.Leuven (December 2003)
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.
Serebrenik, A., Demoen, B.: Refactoring logic programs. Poster. In: Ninetheenth International Conference on Logic Programming, Mumbay, India, December 9-13 (2003)
Somogyi, Z., Henderson, F., Conway, T.: Mercury: an efficient purely declarative logic programming language. In: Australian Computer Science Conference
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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