Theory and Practice of Logic Programming
Author:
Keywords:
Prolog, refactoring, Science & Technology, Technology, Computer Science, Software Engineering, Computer Science, Theory & Methods, Logic, Computer Science, Science & Technology - Other Topics, software engineering, program transformation, programming environments, tools, cs.SE, D.2.7; D.1.6, 0801 Artificial Intelligence and Image Processing, 0802 Computation Theory and Mathematics, 0803 Computer Software, Computation Theory & Mathematics, 4602 Artificial intelligence, 4613 Theory of computation
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.