Graph-based Pattern-oriented, Context-sensitive Code Completion

Anh Tuan Nguyen, Tung Thanh Nguyen, Hoan Anh Nguyen, Ahmed Tamrawi, Hung Viet Nguyen, Jafar Al-Kofahi,
Tien N. Nguyen

Video Demo Downloads

Architect Overview

 

Example 1
Figure 1. Architect Overview

 

Figure 1 shows the overall architecture of GraPacc with four main modules:

  1. Pattern Management: this module is responsible for the management of the database of patterns. It uses GrouMiner for automatic mining the patterns from any codebase. Users can also manually create the patterns and/or modify/refine the patterns mined by GrouMiner via a simple graphical editor provided by GraPacc. GraPacc analyzes the patterns in the database to extract their features and weights, and those features are used to index the patterns for its efficient retrieval in searching and ranking steps.
  2. Query Processing and Feature Extraction: this module is responsible for analyzing the query (i.e. the code under editing), extracting its context-sensitive information including the features and their associated weights, which are calculated based on the context-sensitive factors such as the current editing position and the connectivity of nodes in the corresponding Groum. Those features and weights are used in the searching and ranking step.
  3. Searching and RankingModule: thismodule uses the features extracted from the query to search for the candidate patterns in the pattern database. Those patterns are then ranked and presented to users.
  4. Code Completion: when a user selects a pattern in the recommended ranked list, this module matches the code under editing to the user's chosen pattern, and adapts and inserts the remaining of the pattern into the current code. This module and the query processing module take advantage of the editing support from Eclipse.