Ivie: Lightweight Anchored Explanations of Just-Generated Code

Litao Yan,Alyssa Hwang,Zhiyuan Wu,Andrew Head
DOI: https://doi.org/10.1145/3613904.3642239
2024-03-05
Abstract:Programming assistants have reshaped the experience of programming into one where programmers spend less time writing and more time critically examining code. In this paper, we explore how programming assistants can be extended to accelerate the inspection of generated code. We introduce an extension to the programming assistant called Ivie, or instantly visible in-situ explanations. When using Ivie, a programmer's generated code is instantly accompanied by explanations positioned just adjacent to the code. Our design was optimized for extremely low-cost invocation and dismissal. Explanations are compact and informative. They describe meaningful expressions, from individual variables to entire blocks of code. We present an implementation of Ivie that forks VS Code, applying a modern LLM for timely segmentation and explanation of generated code. In a lab study, we compared Ivie to a contemporary baseline tool for code understanding. Ivie improved understanding of generated code, and was received by programmers as a highly useful, low distraction, desirable complement to the programming assistant.
Human-Computer Interaction
What problem does this paper attempt to address?
### Problems the Paper Attempts to Solve The paper explores how to accelerate the process of programmers understanding generated code through programming assistants (such as GitHub Copilot). Specifically, the paper introduces a tool called "Ivie," which can instantly generate brief and useful textual explanations to assist programmers in understanding the generated code. These explanations are displayed directly next to the code, aiming to help programmers quickly grasp unfamiliar APIs and code structures. ### Specific Goals 1. **Improve the Understandability of Generated Code**: Help programmers better understand the generated code by instantly displaying brief explanations. 2. **Reduce Cognitive Load**: Lower the cognitive burden on programmers by reducing the time they need to look up additional information to understand the code. 3. **Enhance Programming Experience**: Provide clear and concise explanations so that programmers can quickly assess whether the code meets their expectations and make necessary modifications. 4. **Support Understanding at Multiple Levels of Abstraction**: Explain not only expressions within a single line of code but also the behavior of multi-line code blocks to help programmers understand the code from different perspectives. In summary, Ivie aims to be a useful, low-interference tool that complements existing programming assistant functionalities, enhancing programmers' work efficiency and code comprehension.