Abstract
Context: Application Programming Interface (API) code examples are an essential knowledge resource for learning APIs. However, a few user studies have explored how the structural characteristics of the source code in code examples impact their comprehensibility and reusability.Objectives: We investigated whether the (a) linearity and (b) length of the source code in API code examples affect users' performance in terms of correctness and time spent. We also collected subjective ratings.Methods: We conducted an online controlled code comprehension experiment with 61 Java developers. As a case study, we used the API code examples from the Joda-Time Java library. We had participants perform code comprehension and reuse tasks on variants of the example with different lengths and degrees of linearity.Findings: Participants demonstrated faster reaction times when exposed to linear code examples. However, no substantial differences in correctness or subjective ratings were observed.Implications: Our findings suggest that the linear presentation of a source code may enhance initial example understanding and reusability. This, in turn, may provide API developers with some insights into the effective structuring of their API code examples. However, we highlight the need for further investigation.
Original language | English |
---|---|
Title of host publication | Proceedings - 2024 32nd IEEE/ACM International Conference on Program Comprehension, ICPC 2024 |
Publisher | IEEE Computer Society |
Pages | 236-240 |
Number of pages | 5 |
ISBN (Electronic) | 9798400705861 |
DOIs | |
Publication status | Published - 13 Jun 2024 |
Event | 32nd IEEE/ACM International Conference on Program Comprehension, ICPC 2024 - Lisbon, Portugal Duration: 15 Apr 2024 → 16 Apr 2024 |
Publication series
Name | IEEE International Conference on Program Comprehension |
---|---|
ISSN (Print) | 2643-7147 |
ISSN (Electronic) | 2643-7171 |
Conference
Conference | 32nd IEEE/ACM International Conference on Program Comprehension, ICPC 2024 |
---|---|
Country/Territory | Portugal |
City | Lisbon |
Period | 15/04/24 → 16/04/24 |
Bibliographical note
Publisher Copyright:© 2024 ACM. This is an author-produced version of the published paper. Uploaded in accordance with the University’s Research Publications and Open Access policy.
Keywords
- API code examples
- API comprehension
- controlled experiment
- human factors in software engineering
- source code linearity