Title | Relationship-Aware Code Search for JavaScript Frameworks |
Authors | Li, Xuan Wang, Zerui Wang, Qianxiang Yang, Shoumeng Xie, Tao Mei, Hong |
Affiliation | Peking Univ, Key Lab High Confidence Software Technol, Sch Elect Engn & Comp Sci, Minist Educ,Inst Software, Beijing, Peoples R China. Intel China Res Ctr, Beijing, Peoples R China. Univ Illinois, Dept Comp Sci, Urbana, IL USA. |
Keywords | Code search JavaScript code mining natural language processing |
Issue Date | 2016 |
Publisher | 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE) |
Citation | 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE).2016,690-701. |
Abstract | JavaScript frameworks, such as jQuery, are widely used for developing web applications. To facilitate using these JavaScript frameworks to implement a feature (e.g., functionality), a large number of programmers often search for code snippets that implement the same or similar feature. However, existing code search approaches tend to be ineffective, without taking into account the fact that JavaScript code snippets often implement a feature based on various relationships (e.g., sequencing, condition, and callback relationships) among the invoked framework API methods. To address this issue, we present a novel Relationship Aware Code Search (RACS) approach for finding code snippets that use JavaScript frameworks to implement a specific feature. In advance, RACS collects a large number of code snippets that use some JavaScript frameworks, mines API usage patterns from the collected code snippets, and represents the mined patterns with method call relationship (MCR) graphs, which capture framework API methods' signatures and their relationships. Given a natural language (NL) search query issued by a programmer, RACS conducts NL processing to automatically extract an action relationship (AR) graph, which consists of actions and their relationships inferred from the query. In this way, RACS reduces code search to the problem of graph search: finding similar MCR graphs for a given AR graph. We conduct evaluations against representative real-world jQuery questions posted on Stack Overflow, based on 308,294 code snippets collected from over 81,540 files on the Internet. The evaluation results show the effectiveness of RACS: the top 1 snippet produced by RACS matches the target code snippet for 46% questions, compared to only 4% achieved by a relationship-oblivious approach. |
URI | http://hdl.handle.net/20.500.11897/459857 |
DOI | 10.1145/2950290.2950341 |
Indexed | CPCI-S(ISTP) |
Appears in Collections: | 信息科学技术学院 高可信软件技术教育部重点实验室 |