Just-In-Time obsolete comment detection and update

Comments are valuable resources for the development, comprehension and maintenance of software. However, while changing code, developers sometimes neglect the evolution of the corresponding comments, resulting in obsolete comments. Such obsolete comments can mislead developers and introduce bugs in...

Full description

Saved in:
Bibliographic Details
Main Authors: LIU, Zhongxin, XIA, Xin, LO, David, YAN, Meng, LI, Shangping
Format: text
Language:English
Published: Institutional Knowledge at Singapore Management University 2023
Subjects:
Online Access:https://ink.library.smu.edu.sg/sis_research/7769
https://ink.library.smu.edu.sg/context/sis_research/article/8772/viewcontent/tse221_JIT_ObsoleteComment_av.pdf
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Singapore Management University
Language: English
id sg-smu-ink.sis_research-8772
record_format dspace
spelling sg-smu-ink.sis_research-87722023-02-23T08:06:01Z Just-In-Time obsolete comment detection and update LIU, Zhongxin XIA, Xin LO, David YAN, Meng LI, Shangping Comments are valuable resources for the development, comprehension and maintenance of software. However, while changing code, developers sometimes neglect the evolution of the corresponding comments, resulting in obsolete comments. Such obsolete comments can mislead developers and introduce bugs in the future, and are therefore detrimental. We notice that by detecting and updating obsolete comments in time with code changes, obsolete comments can be effectively reduced and even avoided. We refer to this task as Just-In-Time (JIT) Obsolete Comment Detection and Update. In this work, we propose a two-stage framework named CUP2 (Two-stage Comment UPdater) to automate this task. CUP2 consists two components, i.e., an Obsolete Comment Detector named OCD and a Comment UPdater named CUP, each of which relies on a distinct neural network model to perform detection (updates). Specifically, given a code change and a corresponding comment, CUP2 first leverages OCD to predict whether this comment should be updated. If the answer is yes, CUP will be used to generate the new version of the comment automatically. To evaluate CUP2 , we build a large-scale dataset with over 4 million code-comment change samples. Our dataset focuses on method-level code changes and updates on method header comments considering the importance and widespread use of such comments. Evaluation results show that 1) both OCD and CUP outperform their baselines by significant margins, and 2) CUP2 performs better than a rule-based baseline. Specifically, the comments generated by CUP2 are identical to the ground truth for 41.8% of the samples that are predicted to be positive by OCD. We believe CUP2 can help developers detect obsolete comments, better understand where and how to update obsolete comments and reduce their edits on obsolete comment updates. 2023-01-01T08:00:00Z text application/pdf https://ink.library.smu.edu.sg/sis_research/7769 info:doi/10.1109/TSE.2021.3138909 https://ink.library.smu.edu.sg/context/sis_research/article/8772/viewcontent/tse221_JIT_ObsoleteComment_av.pdf http://creativecommons.org/licenses/by-nc-nd/4.0/ Research Collection School Of Computing and Information Systems eng Institutional Knowledge at Singapore Management University Code-comment co-evolution comment update obsolete comment detection Software Engineering
institution Singapore Management University
building SMU Libraries
continent Asia
country Singapore
Singapore
content_provider SMU Libraries
collection InK@SMU
language English
topic Code-comment co-evolution
comment update
obsolete comment detection
Software Engineering
spellingShingle Code-comment co-evolution
comment update
obsolete comment detection
Software Engineering
LIU, Zhongxin
XIA, Xin
LO, David
YAN, Meng
LI, Shangping
Just-In-Time obsolete comment detection and update
description Comments are valuable resources for the development, comprehension and maintenance of software. However, while changing code, developers sometimes neglect the evolution of the corresponding comments, resulting in obsolete comments. Such obsolete comments can mislead developers and introduce bugs in the future, and are therefore detrimental. We notice that by detecting and updating obsolete comments in time with code changes, obsolete comments can be effectively reduced and even avoided. We refer to this task as Just-In-Time (JIT) Obsolete Comment Detection and Update. In this work, we propose a two-stage framework named CUP2 (Two-stage Comment UPdater) to automate this task. CUP2 consists two components, i.e., an Obsolete Comment Detector named OCD and a Comment UPdater named CUP, each of which relies on a distinct neural network model to perform detection (updates). Specifically, given a code change and a corresponding comment, CUP2 first leverages OCD to predict whether this comment should be updated. If the answer is yes, CUP will be used to generate the new version of the comment automatically. To evaluate CUP2 , we build a large-scale dataset with over 4 million code-comment change samples. Our dataset focuses on method-level code changes and updates on method header comments considering the importance and widespread use of such comments. Evaluation results show that 1) both OCD and CUP outperform their baselines by significant margins, and 2) CUP2 performs better than a rule-based baseline. Specifically, the comments generated by CUP2 are identical to the ground truth for 41.8% of the samples that are predicted to be positive by OCD. We believe CUP2 can help developers detect obsolete comments, better understand where and how to update obsolete comments and reduce their edits on obsolete comment updates.
format text
author LIU, Zhongxin
XIA, Xin
LO, David
YAN, Meng
LI, Shangping
author_facet LIU, Zhongxin
XIA, Xin
LO, David
YAN, Meng
LI, Shangping
author_sort LIU, Zhongxin
title Just-In-Time obsolete comment detection and update
title_short Just-In-Time obsolete comment detection and update
title_full Just-In-Time obsolete comment detection and update
title_fullStr Just-In-Time obsolete comment detection and update
title_full_unstemmed Just-In-Time obsolete comment detection and update
title_sort just-in-time obsolete comment detection and update
publisher Institutional Knowledge at Singapore Management University
publishDate 2023
url https://ink.library.smu.edu.sg/sis_research/7769
https://ink.library.smu.edu.sg/context/sis_research/article/8772/viewcontent/tse221_JIT_ObsoleteComment_av.pdf
_version_ 1770576470707535872