skip to main content
10.1145/2950290.2950341acmconferencesArticle/Chapter ViewAbstractPublication PagesfseConference Proceedingsconference-collections
research-article

Relationship-aware code search for JavaScript frameworks

Published:01 November 2016Publication History

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.

References

  1. Annie T. T. Ying and Martin P. Robillard. Selection and presentation practices for code example summarization. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE '14), pp. 460-471, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Siddharth Subramanian and Reid Holmes. Making sense of online code snippets. In Proceedings of the 10th Working Conference on Mining Software Repositories (MSR '13), pp. 85-88, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. David Mandelin, Lin Xu, Rastislav Bodik, and Doug Kimelman. Jungloid mining: helping to navigate the API jungle. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '05), pp. 48-61, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Yan Xu, Lili Mou, Ge Li, Yunchuan Chen, Hao Peng, and Zhi Jin. Classifying relations via long short term memory networks along shortest dependency paths. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP '15), pp. 1785-1794, 2015.Google ScholarGoogle ScholarCross RefCross Ref
  5. Suresh Thummalapenta and Tao Xie. PARSEWeb: A programmer assistant for reusing open source code on the web. In Proceedings of the 22nd IEEE/ACM International Conference on Automated Software Engineering (ASE '07), pp. 204-213, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Hao Zhong, Tao Xie, Lu Zhang, Jian Pei, and Hong Mei. MAPO: Mining and recommending API usage patterns. In Proceedings of the 23rd European Conference on Object-Oriented Programming (ECOOP '09), pp. 318-343, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Shaunak Chatterjee, Sudeep Juvekar, and Koushik Sen. SNIFF: A search engine for Java using free-form queries. In Proceedings of the 12th International Conference on Fundamental Approaches to Software Engineering (FASE '09), pp. 385-400, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Iman Keivanloo, Juergen Rilling, and Ying Zou. Spotting working code examples. In Proceedings of the 36th International Conference on Software Engineering (ICSE '14), pp. 664-675, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Hung Viet Nguyen, Hoan Anh Nguyen, Anh Tuan Nguyen, and Tien N. Nguyen. Mining interprocedural, data-oriented usage patterns in JavaScript web applications. In Proceedings of the 36th International Conference on Software Engineering (ICSE '14), pp. 791-802, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Vasile Rus, Mihai Lintean, Rajendra Banjade, Nobal Niraula, and Dan Stefanescu. SEMILAR: The semantic similarity toolkit. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (ACL '13), Demo Track, 2013.Google ScholarGoogle Scholar
  11. Sumit Gulwani and Mark Marron. NLyze: interactive programming by natural language for spreadsheet data analysis and manipulation. In Proceedings of the 2014 ACM SIGMOD International Conference on Management of Data (SIGMOD '14), pp. 803-814, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Vu Le, Sumit Gulwani, and Zhendong Su. SmartSynth: synthesizing smartphone automation scripts from natural language. In Proceeding of the 11th Annual International Conference on Mobile Systems, Applications, and Services (MobiSys '13), pp. 193-206, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Rada Mihalcea, Courtney Corley, and Carlo Strapparava. Corpus-based and knowledge-based measures of text semantic similarity. In Proceedings of the 21st National Conference on Artificial Intelligence (AAAI '06), pp. 775-780, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Lili Mou, Ge Li, Lu Zhang, Tao Wang, and Zhi Jin. Convolutional neural networks over tree structures for programming language processing. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence (AAAI '16), pp. 1287-1293, 2016.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Esben Andreasen and Anders Møller. Determinacy in static analysis for jQuery. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA '14), pp. 17-31, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. http://w3techs.com/technologies/overview/JavaScript_library/allGoogle ScholarGoogle Scholar
  17. Rahul Pandita, Xusheng Xiao, Hao Zhong, Tao Xie, Stephen Oney, and Amit Paradkar. Inferring method specifications from natural language API descriptions. In Proceedings of the 34th International Conference on Software Engineering (ICSE '12), pp. 815-825, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Xusheng Xiao, Amit Paradkar, Suresh Thummalapenta, and Tao Xie. Automated extraction of security policies from natural-language software documents. In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering (FSE '12), pp. 1-11, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Dan Klein and Christopher D. Manning. Accurate unlexicalized parsing. In Proceedings of the 41st Annual Meeting on Association for Computational Linguistics (ACL 03), pp. 423-430, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Hao Zhong, Lu Zhang, Tao Xie, and Hong Mei. Inferring resource specifications from natural language API documentation. In Proceedings of the 2009 IEEE/ACM International Conference on Automated Software Engineering (ASE '09), pp. 307-318, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Emily Hill, Lori Pollock, and K. Vijay-Shanker. Automatically capturing source code context of NL-queries for software maintenance and reuse. In Proceedings of the 31st International Conference on Software Engineering (ICSE '09), pp. 232-242, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Jue Wang, Yingnong Dang, Hongyu Zhang, Kai Chen, Tao Xie, and Dongmei Zhang. Mining succinct and high-coverage API usage patterns from source code. In Proceedings of the 10th Working Conference on Mining Software Repositories (MSR '13), pp. 319-328, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Reid Holmes, Robert J. Walker, and Gail C. Murphy. Strathcona example recommendation tool. In Proceedings of the 10th European Software Engineering Conference held jointly with 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering (ESEC/FSE '13), pp. 237-240, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Alon Mishne, Sharon Shoham, and Eran Yahav. Typestate-based semantic code search over partial programs. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA '12), pp. 997-1016, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Naiyana Sahavechaphan and Kajal Claypool. XSnippet: mining For sample code. In Proceedings of the 21st ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA '06), pp. 413-430, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Steven P. Reiss. Semantics-based code search. In Proceedings of the 31st International Conference on Software Engineering (ICSE '09), pp. 243-253, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Collin McMillan, Mark Grechanik, Denys Poshyvanyk, Qing Xie, and Chen Fu. Portfolio: finding relevant functions and their usage. In Proceedings of the 33rd International Conference on Software Engineering (ICSE '11), pp. 111-120, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. http://www.alexa.com/topsitesGoogle ScholarGoogle Scholar
  29. Jeffrey Stylos and Brad A. Myers. Mica: A web-search tool for finding API components and examples. In Proceedings of the Visual Languages and Human-Centric Computing (VLHCC '06), pp. 195-202, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Emily Hill, Zachary P. Fry, Haley Boyd, Giriprasad Sridhara, Yana Novikova, Lori Pollock, and K. Vijay-Shanker. AMAP: automatically mining abbreviation expansions in programs to enhance software maintenance tools. In Proceedings of the 2008 International Working Conference on Mining Software Repositories (MSR '08), pp. 79-88, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Mark Grechanik, Chen Fu, Qing Xie, Collin McMillan, Denys Poshyvanyk, and Chad Cumby. A search engine for finding highly relevant applications. In Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering (ICSE '10), pp. 475-484, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Giriprasad Sridhara, Lori Pollock, and K. Vijay-Shanker. Automatically detecting and describing high level actions within methods. In Proceedings of the 33rd International Conference on Software Engineering (ICSE '11) pp. 101-110, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Ethan Fast, Daniel Steffee, Lucy Wang, Joel R. Brandt, and Michael S. Bernstein. Emergent, crowd-scale programming practice in the IDE. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI '14), pp. 2491-2500, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Wing-Kwan Chan, Hong Cheng, and David Lo. Searching connected API subgraph via text phrases. In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering (FSE '12), pp. 1-11, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Fei Lv, Hongyu Zhang, Jian-guang Lou, Shaowei Wang, Dongmei Zhang, and Jianjun Zhao. CodeHow: Effective code search based on API understanding and extended boolean model. In Proceedings of the 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15), pp. 260-270, 2015.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Hao Peng, Lili Mou, Ge Li, Yuxuan Liu, Lu Zhang, and Zhi Jin. Building program vector representations for deep learning. In Proceedings of the 8th International Conference on Knowledge Science, Engineering and Management (KSEM '15), pp. 547-553, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Relationship-aware code search for JavaScript frameworks

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        FSE 2016: Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering
        November 2016
        1156 pages
        ISBN:9781450342186
        DOI:10.1145/2950290

        Copyright © 2016 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 November 2016

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate17of128submissions,13%

        Upcoming Conference

        FSE '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader