Refactoring is an established technique from the object-oriented (OO)programming community to restructure code: it aims at improving softwarereadability, maintainability and extensibility. Although refactoring is nottied to the OO-paradigm in particular, its ideas have not been applied toLogic Programming until now.This paper applies the ideas of refactoring to Prolog programs. A catalogueis presented listing refactorings classified according to scope. Some ofthe refactorings have been adapted from the OO-paradigm, while others have beenspecifically designed for Prolog. The discrepancy between intendedand 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 Prologlegacy system is reported. The main conclusion is that refactoring is botha viable technique in Prolog and a rather desirable one.
展开▼