Source Code Documentation Generation Using Program Execution

Autor: Matúš Sulír, Jaroslav Porubän
Jazyk: angličtina
Rok vydání: 2017
Předmět:
Zdroj: Information, Vol 8, Iss 4, p 148 (2017)
Druh dokumentu: article
ISSN: 2078-2489
DOI: 10.3390/info8040148
Popis: Automated source code documentation approaches often describe methods in abstract terms, using the words contained in the static source code or code excerpts from repositories. In this paper, we describe DynamiDoc: a simple automated documentation generator based on dynamic analysis. Our representation-based approach traces the program being executed and records string representations of concrete argument values, a return value and a target object state before and after each method execution. Then, for each method, it generates documentation sentences with examples, such as “When called on [3, 1.2] with element = 3, the object changed to [1.2]”. Advantages and shortcomings of the approach are listed. We also found out that the generated sentences are substantially shorter than the methods they describe. According to our small-scale study, the majority of objects in the generated documentation have their string representations overridden, which further confirms the potential usefulness of our approach. Finally, we propose an alternative, variable-based approach that describes the values of individual member variables, rather than the state of an object as a whole.
Databáze: Directory of Open Access Journals