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

[1]  David Lo,et al.  Scenario-based and value-based specification mining: better together , 2010, ASE '10.

[2]  Yang Cai,et al.  Api hyperlinking via structural overlap , 2009, ESEC/SIGSOFT FSE.

[3]  Michael D. Ernst,et al.  Automated documentation inference to explain failed tests , 2011, 2011 26th IEEE/ACM International Conference on Automated Software Engineering (ASE 2011).

[4]  Matús Sulír,et al.  Recording concerns in source code using annotations , 2016, Comput. Lang. Syst. Struct..

[5]  Martin P. Robillard,et al.  How API Documentation Fails , 2015, IEEE Software.

[6]  Westley Weimer,et al.  Automatic documentation inference for exceptions , 2008, ISSTA '08.

[7]  Andrew Warfield,et al.  Execution mining , 2012, VEE '12.

[8]  Harald C. Gall,et al.  The impact of test case summaries on bug fixing performance: an empirical investigation , 2016, PeerJ Prepr..

[9]  Lori L. Pollock,et al.  Generating Parameter Comments and Integrating with Method Summaries , 2011, 2011 IEEE 19th International Conference on Program Comprehension.

[10]  Frank Maurer,et al.  SpyREST: Automated RESTful API Documentation Using an HTTP Proxy Server (N) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[11]  Douglas Kramer,et al.  API documentation from source code comments: a case study of Javadoc , 1999, SIGDOC '99.

[12]  Westley Weimer,et al.  Synthesizing API usage examples , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[13]  Jaroslav Poruban,et al.  Semi-automatic concern annotation using differential code coverage , 2015, 2015 IEEE 13th International Scientific Conference on Informatics.

[14]  Matús Sulír,et al.  Generating Method Documentation Using Concrete Values from Executions , 2017, SLATE.

[15]  Emily Hill,et al.  Towards automatically generating summary comments for Java methods , 2010, ASE.

[16]  Matús Sulír,et al.  RuntimeSearch: Ctrl+F for a running program , 2017, 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE).

[17]  Collin McMillan,et al.  Automatic documentation generation via source code summarization of method context , 2014, ICPC 2014.

[18]  Andreas Zeller,et al.  Mining object behavior with ADABU , 2006, WODA '06.

[19]  Seung-won Hwang,et al.  Adding Examples into Java Documents , 2009, 2009 IEEE/ACM International Conference on Automated Software Engineering.

[20]  Daniel Hoffman,et al.  Prose+test cases=specifications , 2000, Proceedings. 34th International Conference on Technology of Object-Oriented Languages and Systems - TOOLS 34.

[21]  Marco Tulio Valente,et al.  Documenting APIs with examples: Lessons learned with the APIMiner platform , 2013, 2013 20th Working Conference on Reverse Engineering (WCRE).

[22]  Lori L. Pollock,et al.  Automatically detecting and describing high level actions within methods , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[23]  Gary T. Leavens,et al.  @tComment: Testing Javadoc Comments to Detect Comment-Code Inconsistencies , 2012, 2012 IEEE Fifth International Conference on Software Testing, Verification and Validation.

[24]  He Jiang,et al.  Summarizing Software Artifacts: A Literature Review , 2016, Journal of Computer Science and Technology.