Skip to main content

Programmers prefer context-aware and lightweight methods of invoking automated refactorings

03 Jan 2012 - planet-eclipse

One of the aspects of automated refactorings that we studied using CodingSpectator was the invocation method. Eclipse JDT supports the following methods of invoking automated refactorings:

A screenshot of Extract Constant refactoring in the Quick Assist menu of
Eclipse

CodingSpectator records if an automated refactoring is invoked using Quick Assist. Our participants used Quick Assist to perform most refactorings except Rename. Specifically, our participants invoked 64% of the refactorings that were supported by Quick Assist (except Rename) using Quick Assist. We hypothesize that programmers use the shortcut key to invoke the Rename refactoring, because this refactoring is very common. However, since CodingSpectator did not report whether a refactoring was invoked using its shortcut key, we cannot confirm or reject this hypothesis.

Our interviews with our participants explained why Quick Assist is a preferred method of invoking refactorings. Refactorings can be quickly invoked using Quick Assist via keyboard. Quick Assist narrows down the decision space by just listing the refactorings that are applicable to the selected context. In addition, Quick Assist requires no configuration. Instead, it uses reasonable default values and lets the programmer tweak the outcome afterwards (See our technical report for more details).

We think that the Quick Assist menu of Eclipse has room for more refactorings. For example, we think it's a good idea to include refactorings like Introduce Parameter, Inline Method, and Inline Constant in Quick Assist (See Eclipse Bugs 255123, 367671, and 367672). Our study has shown the success of a context-aware and lightweight method of invoking refactorings in Eclipse. We believe that similar methods of invoking refactorings may work well in other IDEs like IntelliJ IDEA and NetBeans.