Understanding the API Usage in Java

This is a supplementary web page to accompany our paper which is submitted to the journal of Information and Software Technology

  

Overview

Context: Application Programming Interfaces (APIs) facilitate the use of programming languages. They define sets of rules and specifications for software programs to interact with. The design of language API is usually artistic, driven by aesthetic concerns and the intuitions of language architects. Despite recent studies on limited scope of API usage, there is a lack of comprehensive, quantitative analyses that explore and seek to understand how real-world source code uses language APIs.
Objective: This study aims to understand how APIs are employed in practical development and explore their potential applications based on the results of API usage analysis.
Method: We conduct a large-scale, comprehensive, empirical analysis of the actual usage of APIs on Java, a modern, mature, and widely-used programming language. Our corpus contains over 5,000 open-source Java projects, totalling 150 million source lines of code (SLoC). We study the usage of both core (official) API library and third-party (unofficial) API libraries. We resolve project dependencies automatically, generate accurate resolved abstract syntax trees (ASTs), capture used API entities from over 1.5 million ASTs, and measure the usage based on our defined metrics: frequency, popularity and coverage.
Results: Our study provides detailed quantitative information and yield insight, particularly, (1) confirms the conventional wisdom that the usage of APIs obeys Zipf distribution; (2) demonstrates that core API is not fully used (many classes, methods and fields have never been used); (3) discovers that deprecated API entities (in which some were deprecated long ago) are still widely used; (4) evaluates that the use of current compact profiles is under-utilized; (5) identifies API library coldspots and hotspots.
Conclusions: Our findings are suggestive of potential applications across language API design, optimization and restriction, API education, library recommendation and compact profile construction.

More details are shown in the full version of this study.

  

Results

We studied 5185 Java open-source projects from github, one of the most popular Web-based Git repository hosting service.
The results of this paper are shown as follows:
API Popularity: Packages   Classes   Methods (Part 1)   Methods (Part 2)   Methods (Part 3)   Methods (Part 4)   Fields (Part 1)   Fields (Part 2)   Fields (Part 3)  
API Coverage: JDK1.1   JDK1.2   JDK1.3   JDK1.4   JDK1.5   JDK1.6   JDK1.7   JDK1.8  

  

Authors

  • Dong Qiu - Southest University, China
    E-mail: dongqiu at seu dot edu dot cn

  • Bixin Li - Southest University, China
    E-mail: bx.li at seu dot edu dot cn

  • Hareton Leung - Hong Kong Polytechnic University, Hong Kong, China
    E-mail: hareton dot leung at polyu dot edu dot hk