An Application of Program Slicing and CodeBERT to Distill Variables With Inappropriate Names | IEEE Conference Publication | IEEE Xplore

An Application of Program Slicing and CodeBERT to Distill Variables With Inappropriate Names


Abstract:

Variables are essential for handling objects and data in a program, and their names can provide helpful clues to understanding the program. Well-chosen names enhance code...Show More

Abstract:

Variables are essential for handling objects and data in a program, and their names can provide helpful clues to understanding the program. Well-chosen names enhance code readability. On the other hand, ill-chosen names hinder the comprehension of the program or cause misunderstanding. Al-though a variable's name is worthy of attention, it is challenging to judge whether it is appropriate or not automatically. This paper proposes a method for checking variable names using the program slicing technique and CodeBERT to automate the assessment of variable names. Given a variable in a program, the proposed method extracts the program slice regarding the variable and masks the variable's name. Then, that method tries to predict the masked part using CodeBERT and assesses the original name's adequacy by comparing the predicted names with the original name. A case study shows that the proposed method may detect ill-chosen names with high accuracy (higher than 0.9).
Date of Conference: 30 May 2024 - 01 June 2024
Date Added to IEEE Xplore: 26 September 2024
ISBN Information:

ISSN Information:

Conference Location: Honolulu, HI, USA

Contact IEEE to Subscribe

References

References is not available for this document.