Skip to main content

Identifying and introducing interfaces and callbacks using Wrangler

Lamela Seijas, Pablo and Thompson, Simon (2016) Identifying and introducing interfaces and callbacks using Wrangler. In: Proceedings of the 28th Symposium on the Implementation and Application of Functional Programming Languages. ACM-ICPS International Conference Proceeding Series . ACM, New York, USA. ISBN 978-1-4503-4767-9. (doi:10.1145/3064899.3064909) (Access to this publication is currently restricted. You may be able to access a copy if URLs are provided) (KAR id:64632)

PDF Publisher pdf
Language: English

Restricted to Repository staff only
Contact us about this Publication
[thumbnail of full_paper.pdf]
Official URL


Duplicating code can make it easier to read in some contexts, but in general it is detrimental in several ways: it increases the compilation time, the size of the source code and, more critically, the cost of maintenance and the probability of introducing new bugs during maintenance.

We can avoid code duplication by introducing abstraction for reusable functionalities. This is an established and desirable practice, but it can take considerable effort and it is error prone by itself, which acts as a deterrent.

In this paper, we provide two ways of automating abstraction through refactorings. The first way (that we call iterative) allows developers to introduce an abstraction layer by choosing manually the parts to abstract (one at a time), and the refactoring does the necessary code manipulations. The second way (that we call integrated) takes a partial mapping that identifies equivalent nodes of the ASTs of two modules, and automatically abstracts the mapped common parts to a separate module with a common interface, through the introduction of the template pattern.

Implementation for both of the refactorings, their dependencies, and a matching algorithm to infer partial mappings between two ASTs, are available as part of the open-source refactoring tool Wrangler for Erlang.

Item Type: Book section
DOI/Identification number: 10.1145/3064899.3064909
Uncontrolled keywords: Erlang behaviour; Wrangler; abstraction; template pattern; behaviour extraction; refactoring; generalisation; erlang-diff
Subjects: Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming,
Divisions: Divisions > Division of Computing, Engineering and Mathematical Sciences > School of Computing
Depositing User: Pablo Lamela-Seijas
Date Deposited: 22 Nov 2017 17:09 UTC
Last Modified: 16 Feb 2021 13:50 UTC
Resource URI: (The current URI for this page, for reference purposes)
Thompson, Simon:
  • Depositors only (login required):