Towards Generating Maintainable and Comprehensible API Code Examples

One of the most effective resources for learning application programming interfaces (APIs) is code examples. The shortage of such examples can pose a significant learning obstacle for API users. API users desire simple, understandable, self-contained examples that are easy to reuse in their applicat...

Celý popis

Uloženo v:
Podrobná bibliografie
Vydáno v:Proceedings of the European Conference on Software Maintenance and Reengineering s. 830 - 834
Hlavní autoři: Alharbi, Seham, Kolovos, Dimitris, Matragkas, Nicholas
Médium: Konferenční příspěvek
Jazyk:angličtina
Vydáno: IEEE 12.03.2024
Témata:
ISSN:2640-7574
On-line přístup:Získat plný text
Tagy: Přidat tag
Žádné tagy, Buďte první, kdo vytvoří štítek k tomuto záznamu!
Popis
Shrnutí:One of the most effective resources for learning application programming interfaces (APIs) is code examples. The shortage of such examples can pose a significant learning obstacle for API users. API users desire simple, understandable, self-contained examples that are easy to reuse in their applications. However, writing and maintaining code examples that meet the preferences of API users can be a tedious and repetitive activity for API developers. To address this issue, we present a new approach that aims to ease the writing and maintenance of code examples for API developers, while also improving learnability and comprehension for API users. The approach automatically synthesises linear and more comprehensible API code examples from less repetitive and more maintainable versions by inlining reusable utility methods. We implement this approach in a prototype for the Java programming language. We also evaluate its usefulness in terms of conciseness on a dataset of 600 API code examples extracted from nine open-source Java libraries. The results are encouraging and show that the proposed approach can reduce code repetition and bring a decrease of up to 37% in the lines of code of the evaluated API code examples.
ISSN:2640-7574
DOI:10.1109/SANER60148.2024.00090