Graph-based pattern-oriented, context-sensitive source code completion

  • Authors:
  • Anh Tuan Nguyen;Tung Thanh Nguyen;Hoan Anh Nguyen;Ahmed Tamrawi;Hung Viet Nguyen;Jafar Al-Kofahi;Tien N. Nguyen

  • Affiliations:
  • Iowa State University, USA;Iowa State University, USA;Iowa State University, USA;Iowa State University, USA;Iowa State University, USA;Iowa State University, USA;Iowa State University, USA

  • Venue:
  • Proceedings of the 34th International Conference on Software Engineering
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

Code completion helps improve programming productivity. However, current support for code completion is limited to context-free code templates or a single method call of the variable on focus. Using libraries for development, developers often repeat API usages for certain tasks. Therefore, in this paper, we introduce GraPacc, a graph-based pattern-oriented, context-sensitive code completion approach that is based on a database of API usage patterns. GraPacc manages and represents the API usage patterns of multiple variables, methods, and control structures via graph-based models. It extracts the context-sensitive features from the code, e.g. the API elements on focus or under modification, and their relations to other elements. The features are used to search and rank the patterns that are most fitted with the current code. When a pattern is selected, the current code will be completed via our novel graph-based code completion algorithm. Empirical evaluation on several real-world systems and human subjects shows that GraPacc has a high level of accuracy and a better level of usefulness than existing tools.