Abstract
The naming of local variables is usually at the programmer's discretion. Thus, there is a diversity in naming local variables and this may cause variations in the code quality. Many coding conventions say that the name of a local variable can/should be short. This paper focuses on such conventions, and aims to explore the trends of local variables' names in Java and examine if abnormal local variables create harmful effects on the code quality. This paper collected data on local variables–-names, scopes and types—from six popular open source products, and proposes to evaluate their abnormalities by using the notion of the Mahalanobis distance. The empirical results report the following findings:1) The trend of naming local variables differs according to the variable type; 2) The majority of local variables have short names with narrow scopes, where a name is often a word or its abbreviated form;3) Methods having abnormal local variables are about 1.2 – 2.5 times more likely to be change-prone than the others. While the naming of local variables depends on who writes the code, there seem to be common trend of naming. Java methods with deviant local variables tend to be fixed many times after their release andcannot survive unscathed.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.