arrow
Return

Completing Function Documentation Comments Using Structural Information

delete2023-05-23
delete0
delete
OA
AI
A
Adelina Ciurumelea *
C
Carol V. Alexandru
H
Harald C. Gall
S
Sebastian Proksch
DOI:10.1007/s10664-022-10284-6delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Source code comments are a cornerstone of software documentation facilitating feature development and maintenance. Well-defined documentation formats, like Javadoc, make it easy to include structural metadata used to, for example, generate documentation manuals. However, the actual usage of structural elements in source code comments has not been studied yet. We investigate to which extent these structural elements are used in practice and whether the added information can be leveraged to improve tools assisting developers when writing comments. Existing research on comment generation traditionally focuses on automatic generation of summaries. However, recent works have shown promising results when supporting comment authoring through a next-word prediction. In this paper, we present an in-depth analysis of commenting practice in more than 18K open-source projects written in Python and Java showing that many structural elements, particularly parameter and return value descriptions are indeed widely used. We discover that while a majority are rather short at about 6 to 9 words, many are several hundred words in length. We further find that Python comments tend to be significantly longer than Java comments, possibly due to the weakly-typed nature of the former. Following the empirical analysis, we extend an existing language model with support for structural information, substantially improving the Top-1 accuracy of predicted words (Python 9.6%, Java 7.8%).
Keywords:
Comment completion
Python documentation strings
Javadocs
Neural language models

Journal

Empirical Software Engineering cover
Empirical Software Engineering
IF:
3.6
Papers:
2.0K
Citations:
5.3K

Organization

D
Delft University of Technology
Scholars:
2.6W
Papers: 2.5W
Citations: 3.8W
U
university of zurich
Scholars:
5.1W
Papers: 4.0W
Citations: 65
Cited Papers

Cited Papers

err
IF0
err
err0
errOAAI
err
errShare
errSave
Homeobox Gene Involvement in Normal Hematopoiesis and in the Pathogenesis of Childhood Leukemias
err2017-01-01
err0
PREAI
errMaria Adamaki; Maria Goulielmaki; Ioannis Christodoulou; Spiros Vlahopoulos; Vassilis Zoumpourlis
errShare
errSave
Establishment and characterization of a new triple-negative canine mammary cancer cell line
err2018-10-01
err0
PREAI
errHong Zhang; Shimin Pei; Bin Zhou; Huanan Wang; Hongchao Du; Di Zhang; Degui Lin
errShare
errSave
Measuring Program Comprehension: A Large-Scale Field Study with Professionals
err2018-10-01
err195
errOAAI
errXia, Xin; Bao, Lingfeng; Lo, David; Xing, Zhenchang; Hassan, Ahmed E.; Li, Shanping
errShare
errSave
Urinary retention following routine neurosurgical spine procedures
err2001-01-01
err0
PREAI
errNicholas M Boulis; Farukh S Mian; David Rodriguez; Edward Cho; Julian T Hoff
errShare
errSave
VECTOR-SPACE MODEL FOR AUTOMATIC INDEXING
err1975-11-01
err4.8K
errOAAI
errSALTON, G; WONG, A; YANG, CS
errShare
errSave
researcher View more