Improving prolog programs: Refactoring for prolog

  • Authors:
  • Alexander Serebrenik;Tom Schrijvers;Bart Demoen

  • Affiliations:
  • Laboratory of quality of software (laquso), t.u. eindhoven, hg 5.91, den dolech 2, p.o. box 513, 5600 mb eindhoven, the netherlands (e-mail: a.serebrenik@tue.nl);Department of computer science, k.u. leuven, celestijnenlaan 200a, b-3001, heverlee, belgium (e-mail: tom.schrijvers@cs.kuleuven.be);Department of computer science, k.u. leuven, celestijnenlaan 200a, b-3001, heverlee, belgium (e-mail: bart.demoen@cs.kuleuven.be)

  • Venue:
  • Theory and Practice of Logic Programming
  • Year:
  • 2008

Quantified Score

Hi-index 0.03

Visualization

Abstract

Refactoring is an established technique from the object-oriented (OO) programming 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. The discrepancy between intended and operational semantics in Prolog is also 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. The main conclusion is that refactoring is both a viable technique in Prolog and a rather desirable one.