Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

What do class comments tell us? An investigation of comment evolution and practices in Pharo Smalltalk

Published: 01 November 2021 Publication History

Abstract

Context

Previous studies have characterized code comments in various programming languages, showing how high quality of code comments is crucial to support program comprehension activities, and to improve the effectiveness of maintenance tasks. However, very few studies have focused on understanding developer practices to write comments. None of them has compared such developer practices to the standard comment guidelines to study the extent to which developers follow the guidelines.

Objective

Therefore, our goal is to investigate developer commenting practices and compare them to the comment guidelines.

Method

This paper reports the first empirical study investigating commenting practices in Pharo Smalltalk. First, we analyze class comment evolution over seven Pharo versions. Then, we quantitatively and qualitatively investigate the information types embedded in class comments. Finally, we study the adherence of developer commenting practices to the official class comment template over Pharo versions.

Results

Our results show that there is a rapid increase in class comments in the initial three Pharo versions, while in subsequent versions developers added comments to both new and old classes, thus maintaining a similar code to comment ratio. We furthermore found three times as many information types in class comments as those suggested by the template. However, the information types suggested by the template tend to be present more often than other types of information. Additionally, we find that a substantial proportion of comments follow the writing style of the template in writing these information types, but they are written and formatted in a non-uniform way.

Conclusion

The results suggest the need to standardize the commenting guidelines for formatting the text, and to provide headers for the different information types to ensure a consistent style and to identify the information easily. Given the importance of high-quality code comments, we draw numerous implications for developers and researchers to improve the support for comment quality assessment tools.

References

[1]
Bavota G, Canfora G, Di Penta M, Oliveto R, Panichella S (2013) An empirical investigation on documentation usage patterns in maintenance tasks. In 2013 IEEE International Conference on Software Maintenance pp. 210–219
[2]
Cioch FA, Palazzolo M, Lohrer S (1996) A documentation suite for maintenance programmers. In Proceedings of the 1996 International Conference on Software Maintenance. Washington, DC, USA pp. 286–295
[3]
Cline A (2015) Testing thread. In Agile Development in the Real World. Springer pp. 221–252
[4]
Cornelissen B, Zaidman A, van Deursen A, Moonen L, and Koschke R A systematic survey of program comprehension through dynamic analysis IEEE Trans Softw Eng 2009 35 5 684-702
[5]
de Souza SCB, Anquetil N, de Oliveira KM (2005) A study of the documentation essential to software maintenance. In Proceedings of the 23rd annual international conference on Design of communication: documenting & designing for pervasive information. SIGDOC ’05. New York, NY, USA, pp. 68–75
[6]
de Souza SCB, Anquetil N, and de Oliveira KM Which documentation for software maintenance? J Braz Comput Soc 2006 12 3 31-44
[7]
Dias M, Peck MM, Ducasse S, Arévalo G (2014) Fuel: a fast general purpose object graph serializer. Software: Practice and Experience 44(4):433–453
[8]
Ducasse S, Gîrba T, Nierstrasz O (2005) Moose: an agile reengineering environment. In Proceedings of ESEC/FSE. pp. 99–102
[9]
Farooq M, Khan S, Abid K, Ahmad F, Naeem M, Shafiq M, Abid A (2015) Taxonomy and design considerations for comments in programming languages: A quality perspective. Journal of Quality and Technology Management 10(2)
[10]
Fluri B, Wursch M, Gall HC (2007) Do code and comments co-evolve? On the Relation between Source Code and Comment Changes. In Reverse Engineering. 14th Working Conference on WCRE. pp. 70–79
[11]
Fluri B, Würsch M, Giger E, and Gall HC Analyzing the co-evolution of comments and source code Softw Qual J 2009 17 4 367-394
[12]
Goldberg A and Robson D Smalltalk 80: the Language and its Implementation 1983 Addison Wesley, Reading Mass
[13]
Google Style Guidelines (2020) Verified on 10 Jan 2021
[14]
Guzzi A, Bacchelli A, Lanza M, Pinzger M, van Deursen A (2013). Communication in open source software development mailing lists. In Proceedings of the 10th Working Conference on Mining Software Repositories. IEEE Press, pp. 277–286
[15]
Haiduc S, Aponte J, Moreno L, Marcus A (2010) On the use of automated text summarization techniques for summarizing source code. In 2010 17th Working Conference on Reverse Engineering, pp. 35–44
[16]
Haouari D, Sahraoui HA, Langlais P (2011) How good is your comment? A study of comments in java programs. In Proceedings of the 5th International Symposium on Empirical Software Engineering and Measurement, ESEM 2011, Banff, AB, Canada. IEEE Computer Society pp. 137–146
[17]
Hartzman CS, Austin CF (1993) Maintenance productivity: Observations based on an experience in a large system environment. In Proceedings of the 1993 conference of the Centre for Advanced Studies on Collaborative research: software engineering-Volume 1. IBM Press, pp. 138–170
[18]
Hata H, Treude C, Kula RG, Ishio T (2019) 9.6 million links in source code comments: Purpose, evolution, and decay. In Proceedings of the 41st International Conference on Software Engineering. IEEE Press, pp. 1211–1221
[19]
Ibrahim WM, Bettenburg N, Adams B, and Hassan AE On the relationship between comment update practices and software bugs J Syst Softw 2012 85 10 2293-2304
[20]
Jiang ZM, Hassan AE (2006) Examining the evolution of code comments in PostgreSQL. In Proceedings of the 2006 international workshop on Mining software repositories. ACM, pp. 179–180
[21]
Khamis N, Witte R, Rilling J (2010) Automatic quality assessment of source code comments: the JavadocMiner. In International Conference on Application of Natural Language to Information Systems. Springer, pp. 68–79
[22]
LaToza TD, Myers BA (2010) Hard-to-answer questions about code. In Evaluation and Usability of Programming Languages and Tools, PLATEAU ’10. ACM, New York, NY, USA, pp. 8:1–8:6
[23]
Lidwell W, Holden K, Butler J (2010) Universal Principles of Design. Rockport Publishers
[24]
Liu Y, Sun X, Duan Y (2015) Analyzing program readability based on WordNet. In Proceedings of the 19th International Conference on Evaluation and Assessment in Software Engineering. ACM, pp. 27
[25]
Maalej W, Tiarks R, Roehm T, Koschke R (2014) On the comprehension of program comprehension. ACM TOSEM 23(4):31:1–31:37
[26]
Marin DP (2005) What motivates programmers to comment? Technical Report No. UCB/EECS-2005018, University of California at Berkeley
[27]
Moose (2020) Verified on 10 Jan 2020
[28]
Moreno L, Aponte J, Sridhara G, Marcus A, Pollock LL, Vijay-Shanker K (2013) Automatic generation of natural language summaries for Java classes. In IEEE 21st International Conference on Program Comprehension, ICPC 2013, San Francisco, CA, USA, pp. 23–32
[29]
Nurvitadhi E, Leung WW, Cook C (2003) Do class comments aid Java program understanding? In 33rd Annual Frontiers in Education. FIE,1:T3C–T3C
[30]
Oracle Documentation Guidelines (2020) Verified on 10 Sep 2020. https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
[31]
Padioleau Y, Tan L, Zhou Y (2009) Listening to programmers — taxonomies and characteristics of comments in operating system code. In Proceedings of the 31st International Conference on Software Engineering. IEEE Computer Society, pp. 331–341
[32]
Pascarella L, Bacchelli A (2017) Classifying code comments in Java open-source software systems. In Proceedings of the 14th International Conference on Mining Software Repositories, MSR ’17. IEEE Press, pp. 227–237
[33]
Petrosyan G, Robillard MM, De Mori R (2015) Discovering information explaining API types using text classification. In Proceedings of the 37th International Conference on Software Engineering. IEEE Press, Piscataway, NJ, USA, 1:869–879
[34]
Pharo Consortium (2020) Verified on 10 Jan 2020
[35]
Ratol IK, Robillard MP (2017) Detecting fragile comments. In Proceedings of the 32Nd IEEE/ACM International Conference on Automated Software Engineering. IEEE Press, pp. 112–122
[36]
Robbes R, Pollet D, Lanza M (2010) Replaying IDE interactions to evaluate and improve change prediction approaches. In Proceedings of the 7th IEEE Working Conference on Mining Software Repositories, MSR ’10. IEEE, pp. 161–170
[37]
Replication Package (2019) Verified on 20 Nov 2019
[38]
Scalabrino S, Linares-Vasquez M, Poshyvanyk D, Oliveto R (2016) Improving code readability models with textual features. In 2016 IEEE 24th International Conference on Program Comprehension (ICPC). IEEE, pp. 1–10
[39]
Schreck D, Dallmeier V, Zimmermann T (2007) How documentation evolves over time. In IWPSE ’07: Ninth international workshop on Principles of software evolution. ACM, New York, NY, USA, pp. 4–10
[40]
Shinyama Y, Arahori Y, Gondow K (2018) Analyzing code comments to boost program comprehension. In 2018 25th Asia-Pacific Software Engineering Conference (APSEC). IEEE, pp. 325–334
[41]
Siegmund J and Schumann J Confounding parameters on program comprehension: a literature survey Empir Softw Eng 2015 20 4 1159-1192
[42]
Soetens QD, Robbes R, Demeyer S (2017) Changes as first-class citizens: A research perspective on modern software tooling. ACM Comput Surv, 50(2):18:1–18:38
[43]
Steidl D, Hummel B, Juergens E (2013) Quality analysis of source code comments. In Program Comprehension (ICPC), 2013 IEEE 21st International Conference on, pp. 83–92
[44]
Stylos J, Myers BA, Yang Z (2009) Jadeite: Improving API documentation using usage information. In CHI ’09 Extended Abstracts on Human Factors in Computing Systems, CHI EA ’09, New York, NY, USA, ACM pp. 4429–4434
[45]
Tan L, Yuan D, Krishna G, Zhou Y (2007) /* iComment: Bugs or bad comments?*/. In Proceedings of twenty-first ACM SIGOPS symposium on Operating systems principles, pp. 145–158
[46]
Tenny T (1985) Procedures and comments vs. the banker’s algorithm. ACM SIGCSE Bulletin, 17(3):44–53
[47]
Tenny T Program readability: Procedures versus comments IEEE Trans Softw Eng 1988 14 9 1271-1279
[48]
Tomassetti F, Torchiano M (2014) An empirical assessment of polyglot-ism in GitHub. In Proceedings of the 18th International Conference on Evaluation and Assessment in Software Engineering, pp. 1–4
[49]
Triola M (2006) Elementary Statistics. Addison-Wesley
[50]
Vargha A and Delaney HD A critique and improvement of the CL common language effect size statistics of McGraw and Wong J Educ Behav Stat 2000 25 2 101-132
[51]
Wen F, Nagy C, Bavota G, Lanza M (2019) A large-scale empirical study on code-comment inconsistencies. In Proceedings of the 27th International Conference on Program Comprehension. IEEE Press, pp. 53–64
[52]
Woodfield SN, Dunsmore HE, Shen VY (1981) The effect of modularization and comments on program comprehension. In Proceedings of the 5th international conference on Software engineering. IEEE Press, pp.215–223
[53]
Ying ATT, Wright JL, and Abrams S Source code that talks: An exploration of Eclipse task comments and Their Implication to repository mining SIGSOFT Softw Eng Notes 2005 30 4 1-5
[54]
Zaidman A, Van Rompaey B, Demeyer S, van Deursen A (2008) Mining software repositories to study co-evolution of production and test code. In Software Testing, Verification, and Validation, 2008 1st International Conference on, pp. 220 –229
[55]
Zhang J, Xu L, Li Y (2018) Classifying python code comments based on supervised learning. In X. Meng, R. Li, K. Wang, B. Niu, X. Wang, and G. Zhao, editors, Web Information Systems and Applications - 15th International Conference, WISA 2018, Taiyuan, China, September 14-15, 2018, Proceedings, volume 11242 of Lecture Notes in Computer Science. Springer, pp. 39–47
[56]
Zhou Y, Gu R, Chen T, Huang Z, Panichella S, Gall H (2017) Analyzing APIs documentation and code to detect directive defects. In Proceedings of the 39th International Conference on Software Engineering. IEEE Press, pp. 27–37

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Empirical Software Engineering
Empirical Software Engineering  Volume 26, Issue 6
Nov 2021
1006 pages

Publisher

Kluwer Academic Publishers

United States

Publication History

Published: 01 November 2021
Accepted: 25 May 2021

Author Tags

  1. Commenting practices
  2. Class comment analysis
  3. Comment evolution
  4. Template analysis
  5. Pharo
  6. Program comprehension

Qualifiers

  • Research-article

Funding Sources

  • Schweizerischer Nationalfonds zur Frderung der Wissenschaftlichen Forschung (CH)
  • Universität Bern

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 17 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

View options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media