Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 API Recommendation Wujie Zheng

Similar presentations


Presentation on theme: "1 API Recommendation Wujie Zheng"— Presentation transcript:

1 1 API Recommendation Wujie Zheng wjzheng@cse.cuhk.edu.hk

2 2 Outline Introduction Recommending Co-used Methods for a Given API  Mining-based Approaches  Program-analysis-based Approaches Recommending Method Sequences to Create a Given Type of Object  Mining-based Approaches  Program-analysis-based Approaches Potential Work

3 3 Introduction API Recommendation  To recommend API methods (method sequences) for a given query, which can be a method or a target object type

4 4 Introduction API Recommendation  Tasks To recommend co-used methods for a given API To recommend method sequences to create a given type of object  Approaches Mining-based Approaches Program-analysis-based Approaches

5 5 Recommending Co-used Methods for a Given API The Task  To recommend API methods that are co-used with a given API method  E.g., given a query fopen(), we may recommend fclose()  To help write client code, or study/modify the application/library code

6 6 Recommending Co-used Methods for a Given API Mining-based Approaches  To mine API usage patterns from a code repository  The code repository could be a local repository or a online code repository

7 7 Recommending Co-used Methods for a Given API Mining-based Approaches  PR-Miner Extract programming rules using frequent itemset mining Find 16 bugs in Linux, 6 in PostgreSQL and 1 in Apache

8 8 Recommending Co-used Methods for a Given API Mining-based Approaches  MAPO Mine programming rules using Google code search

9 9 Recommending Co-used Methods for a Given API Program-analysis-based Approaches  To identify related methods based on the Program Dependence Graph

10 10 Recommending Co-used Methods for a Given API Program-analysis-based Approaches  FRIAR Find a base set based on callgraph Rank the methods in the base set using HITS

11 11 Recommending Co-used Methods for a Given API Program-analysis-based Approaches  Altair Build an augmented access graph Define a similarity measurement of methods Cluster the methods using spectral clustering

12 12 Recommending Co-used Methods for a Given API

13 13 Recommending Method Sequences to Create a Given Type of Object The Task  To recommend method sequences that can create a given type of object  E.g., given a query ObjectInputStream, we may recommend FileInputStream f2 = new FileInputStream("test.ser"); ObjectInputStream in = new ObjectInputStream(f2);  To help write client code or study the application/library code

14 14 Recommending Method Sequences to Create a Given Type of Object Mining-based Approaches  To mine method sequences from a code repository

15 15 Recommending Method Sequences to Create a Given Type of Object Mining-based Approaches  PARSEWeb Use Google code search and then mine frequent patterns Google code search provides relevant method sequences The mining procedure provides additional information, e.g., the occurrence of each pattern

16 16 Recommending Method Sequences to Create a Given Type of Object Program-analysis-based Approaches  Prospector (JavaSketch) Build a signature graph, whose edges represent various relationships Given an object type, it backward searches the graph for method sequences that can create an object

17 17 Recommending Method Sequences to Create a Given Type of Object

18 18 Potential Work To recommend alternative methods for a given method  E.g., given a query “kmeans, matlab”, we may recommend “linkage (hierarchical clustering)”  E.g., given a query “push_back, vector”, we may recommend “insert”  Mining? Structural analysis? Content Analysis?

19 19 Potential Work To build a API usage pattern repository  Previous tools check only API usage patterns mined from local repositories, which could fail if developers make the same mistake throughout the code.  Developers may check the API methods one by one using online repositories, which could be tedious.  Can we build a API usage pattern repository in advance?

20 20 Thank you!


Download ppt "1 API Recommendation Wujie Zheng"

Similar presentations


Ads by Google