Source Code Documentation Generation Using Program Execution

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 representat...

Full description

Bibliographic Details
Main Authors: Matúš Sulír, Jaroslav Porubän
Format: Article
Language:English
Published: MDPI AG 2017-11-01
Series:Information
Subjects:
Online Access:https://www.mdpi.com/2078-2489/8/4/148
_version_ 1819085899298766848
author Matúš Sulír
Jaroslav Porubän
author_facet Matúš Sulír
Jaroslav Porubän
author_sort Matúš Sulír
collection DOAJ
description 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.
first_indexed 2024-12-21T21:11:41Z
format Article
id doaj.art-72f48cfc91ec4fbfb727cbd53e80d9f2
institution Directory Open Access Journal
issn 2078-2489
language English
last_indexed 2024-12-21T21:11:41Z
publishDate 2017-11-01
publisher MDPI AG
record_format Article
series Information
spelling doaj.art-72f48cfc91ec4fbfb727cbd53e80d9f22022-12-21T18:50:08ZengMDPI AGInformation2078-24892017-11-018414810.3390/info8040148info8040148Source Code Documentation Generation Using Program ExecutionMatúš Sulír0Jaroslav Porubän1Department of Computers and Informatics, Faculty of Electrical Engineering and Informatics, Technical University of Košice, Letná 9, 042 00 Košice, SlovakiaDepartment of Computers and Informatics, Faculty of Electrical Engineering and Informatics, Technical University of Košice, Letná 9, 042 00 Košice, SlovakiaAutomated 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.https://www.mdpi.com/2078-2489/8/4/148documentation generationsource code summarizationmethod documentationdynamic analysisexamples
spellingShingle Matúš Sulír
Jaroslav Porubän
Source Code Documentation Generation Using Program Execution
Information
documentation generation
source code summarization
method documentation
dynamic analysis
examples
title Source Code Documentation Generation Using Program Execution
title_full Source Code Documentation Generation Using Program Execution
title_fullStr Source Code Documentation Generation Using Program Execution
title_full_unstemmed Source Code Documentation Generation Using Program Execution
title_short Source Code Documentation Generation Using Program Execution
title_sort source code documentation generation using program execution
topic documentation generation
source code summarization
method documentation
dynamic analysis
examples
url https://www.mdpi.com/2078-2489/8/4/148
work_keys_str_mv AT matussulir sourcecodedocumentationgenerationusingprogramexecution
AT jaroslavporuban sourcecodedocumentationgenerationusingprogramexecution