Institute for Software Research
School of Computer Science, Carnegie Mellon University


Backtracking Support in Code Editing

YoungSeok Yoon

May 2015

Ph.D. Thesis (SE)


Keywords: Selective undo, backtracking, fine-grained edit history, logging, timeline visualization, history search, edit collapsing, Eclipse IDE, Java, exploratory programming

Programmers often need to backtrack while coding. Here, "backtracking" refers to when programmers go back at least partially to an earlier state of code, either by removing inserted code or by restoring removed code. For example, when some newly added feature does not work as imagined, the programmer might have to backtrack and try something else. When learning an unfamiliar API, programmers often need to try some sequence of object instantiation and method calls, run the program, and backtrack if the result is not as expected. I conducted a series of three empirical studies in order to better understand the backtracking behavior of programmers. The results indicated that backtracking is prevalent in programming, and programmers often face challenges when backtracking. For example, they had difficulties when trying to find all the relevant parts of code to be backtracked or when trying to restore some code they had deleted that later turned out to be needed.

However, programmers only have very limited support for backtracking in today's tools. The linear undo command can only undo the most recent changes, and loses the undone changes as soon as the programmer makes a single new change after invoking the undo command. Version control systems such as Subversion and Git can also be used for backtracking, but only when the desired code is already committed in the repository. Furthermore, the results from the empirical studies showed that 38% of all the backtrackings are done manually without any tool support and 9.5% are selective, which means that they could not have been performed using the conventional undo command.

To help programmers backtrack more easily and accurately, I devised a novel selective undo mechanism for code editors, and implemented it in an IDE plug-in called AZURITE. The core idea is to combine the following mechanisms into a coherent programming tool: a selective undo mechanism for code editors, novel visualizations of the coding history, and a code change history search. AZURITE retains the full fine-grained code change history, and the selective undo mechanism allows users to select and undo one or more isolated edit operations, while appropriately detecting and handling conflicting operations. The visualizations and history search are the user interfaces that help users to select the desired edit operations to be back-tracked and express what they remember about the code changes that they want to revert. In a controlled lab experiment, programmers using AZURITE performed twice as fast compared to the control group when completing typical backtracking tasks. My hope is that this selective undo tool will help programmers achieve their daily programming tasks more effectively.

231 pages

Thesis Committee:
Brad A. Myers (Chair)
Jonathan Aldrich
Christian Kästner
Emerson Murphy-Hill (North Carolina State University)

William Scherlis, Director, Institute for Software Research
Andrew W. Moore, Dean, School of Computer Science

Return to: SCS Technical Report Collection
School of Computer Science

This page maintained by