Advertisement

Detecting and Ranking API Usage Pattern in Large Source Code Repository: A LFM Based Approach

Conference paper
  • 1.3k Downloads
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10410)

Abstract

Code examples are key resources for helping programmers to learn correct Application Programming Interface (API) usages efficiently. However, most framework and library APIs fail in providing sufficient and adequate code examples in corresponding official documentations. Thus, it takes great programmers’ efforts to browse and extract API usage examples from websites. To reduce such effort, this paper proposes a graph-based pattern-oriented mining approach, LFM-OUPD (Local fitness measure for detecting overlapping usage patterns) for API usage facility, that recommends proper API code examples from data analytics. API method queries are accepted from programmers and corresponding code files are collected from related API dataset. The detailed structural links among API method elements in conceptual source codes are captured and generate a code graph structure. Lancichinetti et al. proposed an overlapping community detecting algorithm (Local fitness measure, LFM), based on the local optimization of a fitness function. In LFM-OUPD, a mining algorithm based on LFM is presented to explore the division of method sequences in the directed source code element graph and detect candidates of different API usage patterns. Then a ranking approach is applied to obtain appropriate API usage pattern and code example candidates. A case study on Google Guava is conducted to evaluate the effectiveness of this approach.

Keywords

Graph mining Source code mining API usage recommendation Data analytics 

References

  1. 1.
    Aeschlimann, M., Baumer, D., Lanneluc, J.: Java tool smithing extending the eclipse java development tools. In: Proceedings of the 2nd EclipseCon (2005)Google Scholar
  2. 2.
    Baumes, J., Goldberg, M.K., Krishnamoorthy, M.S., Magdon-Ismail, M., Preston, N.: Finding communities by clustering a graph into overlapping subgraphs. IADIS AC 5, 97–104 (2005)Google Scholar
  3. 3.
    Bosu, A., Carver, J.C., Bird, C., Orbeck, J., Chockley, C.: Process aspects and social dynamics of contemporary code review: insights from open source development and industrial practice at microsoft. IEEE Trans. Softw. Eng. 42, 302–321 (2016)CrossRefGoogle Scholar
  4. 4.
    Clauset, A.: Finding local community structure in networks. Phys. Rev. E 72(2), 026132 (2005)CrossRefGoogle Scholar
  5. 5.
    Gregory, S.: An algorithm to find overlapping community structure in networks. In: Kok, J.N., Koronacki, J., Lopez de Mantaras, R., Matwin, S., Mladenič, D., Skowron, A. (eds.) PKDD 2007. LNCS, vol. 4702, pp. 91–102. Springer, Heidelberg (2007). doi: 10.1007/978-3-540-74976-9_12 CrossRefGoogle Scholar
  6. 6.
    Ko, A.J., Myers, B., Aung, H.H.: Six learning barriers in end-user programming systems. In: IEEE Symposium on Visual Languages and Human Centric Computing, pp. 199–206 (2004)Google Scholar
  7. 7.
    Lancichinetti, A., Fortunato, S., Kertész, J.: Detecting the overlapping and hierarchical community structure in complex networks. New J. Phys. 11(3), 033015 (2009)CrossRefGoogle Scholar
  8. 8.
    Malliaros, F.D., Vazirgiannis, M.: Clustering and community detection in directed networks: a survey. Phys. Rep. 533(4), 95–142 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Mar, L.W., Wu, Y.C., Jiau, H.C.: Recommending proper API code examples for documentation purpose. In: 2011 18th Asia Pacific Software Engineering Conference (APSEC), pp. 331–338 (2011)Google Scholar
  10. 10.
    Newman, M.E., Girvan, M.: Finding and evaluating community structure in networks. Phys. Rev. E 69(2), 026113 (2004)CrossRefGoogle Scholar
  11. 11.
    Ponzanelli, L., Bavota, G., Di Penta, M., Oliveto, R., Lanza, M.: Prompter: a self-confident recommender system. In: 2014 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 577–580. IEEE (2014)Google Scholar
  12. 12.
    Radevski, S., Hata, H., Matsumoto, K.: Towards building API usage example metrics. In: 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER), vol. 1, pp. 619–623. IEEE (2016)Google Scholar
  13. 13.
    Robillard, M.P.: What makes APIs hard to learn? Answers from developers. Softw. IEEE 26(6), 27–34 (2009)CrossRefGoogle Scholar
  14. 14.
    Saied, M.A., Abdeen, H., Benomar, O., Sahraoui, H.: Could we infer unordered API usage patterns only using the library source code? In: 2015 IEEE 23rd International Conference on Program Comprehension (ICPC), pp. 71–81 (2015)Google Scholar
  15. 15.
    Saied, M.A., Benomar, O., Abdeen, H., Sahraoui, H.: Mining multi-level API usage patterns. In: 2015 IEEE 22nd International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 23–32. IEEE (2015)Google Scholar
  16. 16.
    Sawant, A.A., Bacchelli, A.: A dataset for API usage. In: Proceedings of the 12th Working Conference on Mining Software Repositories, pp. 506–509. IEEE Press (2015)Google Scholar
  17. 17.
    Wang, J., Dang, Y., Zhang, H., Chen, K., Xie, T., Zhang, D.: Mining succinct and high-coverage API usage patterns from source code. In: 2013 10th IEEE Working Conference on Mining Software Repositories (MSR), pp. 319–328 (2013)Google Scholar
  18. 18.
    Wang, L., Fang, L., Wang, L., Li, G., Xie, B., Yang, F.: APIExample: an effective web search based usage example recommendation system for Java APIs. In: 2011 26th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 592–595 (2011)Google Scholar
  19. 19.
    Wu, Y.C., Mar, L.W., Jiau, H.C.: CoDocent: support API usage with code example and API documentation. In: 2010 Fifth International Conference on Software Engineering Advances (ICSEA), pp. 135–140 (2010)Google Scholar
  20. 20.
    Xie, J., Kelley, S., Szymanski, B.K.: Overlapping community detection in networks: the state-of-the-art and comparative study. ACM Comput. Surv. (CSUR) 45(4), 43 (2013)CrossRefzbMATHGoogle Scholar
  21. 21.
    Zagalsky, A., Barzilay, O., Yehudai, A.: Example overflow: using social media for code recommendation. In: 2012 Third International Workshop on Recommendation Systems for Software Engineering (RSSE), pp. 38–42 (2012)Google Scholar
  22. 22.
    Zhong, H., Xie, T., Zhang, L., Pei, J., Mei, H.: MAPO: mining and recommending API usage patterns. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 318–343. Springer, Heidelberg (2009). doi: 10.1007/978-3-642-03013-0_15 CrossRefGoogle Scholar

Copyright information

© IFIP International Federation for Information Processing 2017

Authors and Affiliations

  1. 1.School of Software EngineeringTongji UniversityShanghaiChina

Personalised recommendations