Tags:direct manipulation, program repair and program synthesis
Abstract:
Direct manipulation is a programming paradigm in which the programmer conveys the intended program behavior by modifying program values at runtime. The programming environment then finds a modification of the original program that yields the manipulated values. This paradigm has been successfully applied to drawing editors to provide programming capabilities that allow users to interact with the displayed graphics. In this paper, we propose the first framework for direct manipulation of imperative programs. First, we introduce \emph{direct state manipulation}, which allows programmers to visualize the trace of a buggy program on an input, and modify variable values at a location. Second, we propose a synthesis technique based on program sketching to efficiently find a program modification that yields the manipulated variable values. Third, to avoid diverging too much from the original program, we augment our synthesis technique with quantitative objectives to find the ``closest'' program to the original one that is consistent with the manipulated values. We formalize the problem and build a tool JDial based on the Sketch synthesizer. We investigate the effectiveness of direct manipulation by using \Name to fix benchmarks from introductory programming assignments. In our evaluation, we observe that direct state manipulations are an effective specification mechanism: even when provided with a single state manipulation, JDial can produce desired program modifications for 66% of our benchmarks while techniques based only on test cases always fail.