Just-in-Time Detection of Outdated Comments in Software Development by Jointly Reasoning

Abstract

Code comments are a crucial source of software to learn various aspects of code. However, with the iterative upgrades of software, outdated code comments are increasingly prevalent. Inconsistencies in code comments can mislead developers and lead to potential errors. Due to the complexity of semantic information and interactions between source code and comments, previous studies have difficulty capturing the long-term and non-sequential dependencies in source code and the complex interaction information between code and comments. To address these challenges in outdated comment detection, we propose an approach named OutComDeter consists of the following four components, i.e., the data processing component, the jointly reasoning component, the feature extraction component and the outdated comment detection component. Firstly, the data processing component transforms source code and comments into edit sequences and comment sequences. Subsequently, to address the limitations of existing methods in capturing the interactive information between code and comments, the joint reasoning component employs two encoders with co-matching attention network to incorporate the joint relational information between code and comments into their respective feature representations. This joint relational information thereby contributes to the detection of outdated code comments. Furthermore, to mitigate the interference caused by the lack of long-term and non-sequential dependencies in source code for the task of outdated code comment detection, the feature extraction component leverages multi-head attention layers and dot-product attention layers to capture these dependencies, forming the final feature representations for both code and comments. Finally, the outdated comment detection will detect the outdated comments through a non-linear transformation. The experimental results indicate that OutComDeter outperforms the state-of-the-art methods in detecting outdated comments, as evidenced by higher Precision, Recall, and F1-Score. Compared to the state-of-the-art outdated comments detection methods, OutComDeter achieves an improvement in the F1-score by 70.1% compared to FracoDetector, 69.1% compared to RandomForest, and 11.5% compared to OCD respectively, which could efficiently detect Just-In-Time outdated comments.

Department(s)

Information Technology and Cybersecurity

Document Type

Article

DOI

10.1109/TCE.2025.3535632

Keywords

deep learning, Just-In-Time, outdated comment, software development

Publication Date

1-1-2025

Journal Title

IEEE Transactions on Consumer Electronics

Share

COinS