Scripting parametric refactorings in Java to retrofit design patterns
Scripting parametric refactorings in Java to retrofit design patterns
复制标题
DOI:
10.1109/icsm.2015.7332467
复制
发表时间:
2015-09
期刊:
影响因子:
--
通讯作者:
Jongwook Kim;D. Batory;Danny Dig
中科院分区:
文献类型:
--
作者:
Jongwook Kim;D. Batory;Danny Dig
Retrofitting design patterns into a program by hand is tedious and error-prone. A programmer must distinguish refactorings that are provided by an Integrated Development Environment (IDE) from those that must be realized manually, determine a precise sequence of refactorings to apply, and perform this sequence repetitively to a laborious degree. We designed, implemented, and evaluated Reflective Refactoring (R2), a Java package to automate the creation of classical design patterns (Visitor, Abstract Factory, etc.), their inverses, and variants. We encoded 18 out of 23 Gang-of-Four design patterns as R2 scripts and explain why the remaining are inappropriate for refactoring engines. We evaluate the productivity and scalability of R2 with a case study of 6 real-world applications. In one case, R2 automatically created a Visitor with 276 visit methods by invoking 554 Eclipse refactorings in 10 minutes - an achievement that could not be done manually. R2 also sheds light on why refactoring correctness, expressiveness, and speed are critical issues for scripting in next-generation refactoring engines.