MAPO: mining and recommending api usage patterns

Hao Zhong, Tao Xie, Lu Zhang, Jian Pei, Hong Mei

Research output: Chapter in Book/Report/Conference proceedingConference contribution


To improve software productivity, when constructing new software systems, programmers often reuse existing libraries or frameworks by invoking methods provided in their APIs. Those API methods, however, are often complex and not well documented. To get familiar with how those API methods are used, programmers often exploit a source code search tool to search for code snippets that use the API methods of interest. However, the returned code snippets are often large in number, and the huge number of snippets places a barrier for programmers to locate useful ones. In order to help programmers overcome this barrier, we have developed an API usage mining framework and its supporting tool called MAPO (Mining API usage Pattern from Open source repositories) for mining API usage patterns automatically. A mined pattern describes that in a certain usage scenario, some API methods are frequently called together and their usages follow some sequential rules. MAPO further recommends the mined API usage patterns and their associated code snippets upon programmers' requests. Our experimental results show that with these patterns MAPO helps programmers locate useful code snippets more effectively than two state-of-the-art code search tools. To investigate whether MAPO can assist programmers in programming tasks, we further conducted an empirical study. The results show that using MAPO, programmers produce code with fewer bugs when facing relatively complex API usages, comparing with using the two state-of-the-art code search tools.

Original languageEnglish (US)
Title of host publicationECOOP 2009 - Object-Oriented Programming - 23rd European Conference, Proceedings
Number of pages26
StatePublished - 2009
Externally publishedYes
Event23rd European Conference on Object-Oriented Programming, ECOOP 2009 - Genoa, Italy
Duration: Jul 6 2009Jul 10 2009

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume5653 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Other23rd European Conference on Object-Oriented Programming, ECOOP 2009

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science


Dive into the research topics of 'MAPO: mining and recommending api usage patterns'. Together they form a unique fingerprint.

Cite this