API usage patterns have been considered as significant materials in reusing software library APIs for saving development time and improving software quality. Although efforts have been made on discovering and searching API usage patterns, the following two issues are still largely unexplored: how to provide a well-organized view of the discovered API usage patterns? and how to recommend follow-up API usage patterns once a usage pattern is adopted? This paper proposes two methods for categorizing and recommending API usage patterns: first, categories of the usage patterns are automatically identified based on a proposed degree centrality-based clustering algorithm; and second, follow-up usage patterns of an adopted pattern are recommended based on a proposed metric of measuring distances between patterns. In the experimental evaluations, the patterns categorization can achieve 85.4% precision rate with 83% recall rate. The patterns recommendation had approximately half a chance of correctly predicting the follow-up patterns that were actually used by the programmers.
All Science Journal Classification (ASJC) codes