Automatically Detecting and Describing High Level Actions within Methods

Giriprasad Sridhara, Lori Pollock, and K Vijay-Shanker
University of Delaware, USA

One approach to easing program comprehension is to reduce the amount of code that a developer has to read. Describing the high level abstract algorithmic actions associated with code fragments using succint natural language phrases enables a newcomer to focus on fewer and more abstract concepts when trying to understand a given method. Unfortunately, such descriptions are typically missing because it is tedious to create manually.

We present an automatic technique for identifying code fragments that implement high level abstractions of actions and expressing these abstractions in a concise yet precise manner. Our studies of 1000 Java programs indicate that our heuristics for identifying code fragments implementing high level actions are widely applicable. Judgements of our generated descriptions by 15 experienced Java programmers strongly suggest that indeed they view the fragments that we identify as representing high level actions and our synthesized descriptions accurately express the abstraction.