Refactoring is the process of changing the design of a program without changing its behaviour. Many refactoring tools have been developed for various programming languages; however, their support for composite refactorings – refactorings that are composed from a number of primitive refactorings – is limited. In particular, there is a lack of powerful and easy-to-use frameworks that allow users to script their own large-scale refactorings efficiently and effectively.
This paper introduces the domain-specific language framework of Wrangler – a refactoring and code inspection tool for Erlang programs – that allows users to script composite refactorings, test them and apply them on the fly. The composite refactorings are fully integrated into Wrangler and so can be previewed, applied and ‘undone’ interactively.
As a part of the presentation there will be a demonstration of the DSL in action, showing how complex refactorings can easily be described using the language, which is itself embedded in Erlang. This demonstration will include a set of refactorings designed to eliminate "bug preconditions" in Erlang models for components, as well as the Wrangler mechanism for synthesising API migration refactorings, illustrated by the example of moving from the regexp to the re library for regular expressions in Erlang/OTP.