Researchers have come up with a new way to give programmers access to refactoring tools, hopefully making the process more intuitive and making it more likely that programmers will use the tools.
Refactoring is when you change the structure of a piece of a code without changing what the code actually does – you might change the way it does it, but the end result is the same.
Why would you want to do this? Because changing the structure can make it easier for programmers to revise or update the overall program. For example, refactoring can make it easier for programmers to identify and fix bugs in the program.
But refactoring can be time consuming, and creates the potential for new bugs to get into the code when programmers enter the changes manually. As a result, tools have been created to partially automate the refactoring process, making it faster and less error-prone. However, programmers often don’t use these tools.
One of the reasons these tools are often ignored is because using them involves either pulling up an unwieldy drop-down menu or memorizing a list of “hot keys,” or key combinations.
Researchers from NC State and Portland State University have developed a solution to this particular problem by utilizing so-called marking menus. In this approach, programmers can highlight the portion of code to be refactored and click the mouse to pull up a marking menu, which appears as a circle with the various refactoring options arrayed around the code – much like a pie chart. The refactoring options available in the menu vary, depending on which tools are applicable to the code that’s been highlighted.
The researchers designed the marking menus so that the refactoring tools are laid out in a way that makes sense to programmers. For example, tools that have opposite functions appear opposite each other in the marking menu. And tools that have similar functions in different contexts will appear in the same place on their respective marking menus.
Early testing shows that programmers were able to grasp the marking menu process quickly, and the layout of the tools within the menus was intuitive. A paper describing the new menus and early testing will be presented Sept. 21 at the IEEE Symposium on Visual Languages and Human-Centric Computing in Pittsburgh, Penn. The paper was co-authored by Emerson Murphy-Hill and Moin Ayazifar of NC State and Andrew P. Black of Portland State. The research was partially supported by the National Science Foundation.
One next step, according to Murphy-Hill, is to get more programmers to use the marking menus for a longer period of time, in order to evaluate whether they encourage programmers to use the refactoring tools more often. The researchers also plan to explore whether similar marking menu mapping efforts would work well in other software contexts, such as photo-editing programs.