Using Twinning to Adapt Programs to Alternative APIs
The authors describe twinning and its applications to adapting programs to alternative APIs. Twinning is a simple technique that allows programmers to specify a class of program changes, in the form of a mapping, without modifying the target program directly. Using twinning, programmers can specify changes that transition a program from using one API to using an alternative API. They describe two related mapping-based source-to-source transformations. The first applies the mapping to a program, producing a copy with the changes applied. The second generates a new API that abstracts the changes specified in the mapping. Using this API, programmers can invoke either the old (replaced) code or the new (replacement) code through a single interface.