Recommending rename refactorings

Variable names play a major role in program comprehension. However, their choice is often subject to the intuition (or intention) of individual programmers: although code conventions and style guides may constrain identifier usage, programmers are individuals naming program concepts individually. Especially if different parts of a program are written by different programmers, inconsistent naming of program entities may follow. This is unfortunate, since consistent naming would aid program comprehension, in particular if references pointing to same objects used in similar ways are named equally. As a first approach, we focus on assignments to discover possible inconsistency of naming, exploiting that a variable assigned to another likely points to same objects and, if declared with the same type, is likely used for the same purpose. To explore the feasibility of our approach, we implemented a tool recommending rename refactorings to harmonize variable names based on an analysis of assignments and static type information. Evaluated on some open source projects the results seem promising enough to aim for some extensions, such as application to method names, inferred type information, and weakly type-checked languages.

[1]  Paolo Tonella,et al.  Restructuring program identifier names , 2000, Proceedings 2000 International Conference on Software Maintenance.

[2]  Einar W. Høst,et al.  Debugging Method Names , 2009, ECOOP.

[3]  David W. Binkley,et al.  What’s in a Name? A Study of Identifiers , 2006, 14th IEEE International Conference on Program Comprehension (ICPC'06).

[4]  Markus Pizka,et al.  Concise and consistent naming , 2005, 13th International Workshop on Program Comprehension (IWPC'05).

[5]  Friedrich Steimann,et al.  Decoupling classes with inferred interfaces , 2006, SAC.

[6]  Friedrich Steimann,et al.  The Infer Type Refactoring and its Use for Interface-Based Programming , 2007, J. Object Technol..

[7]  Raymond P. L. Buse,et al.  A metric for software readability , 2008, ISSTA '08.

[8]  David W. Binkley,et al.  Quantifying identifier quality: an analysis of trends , 2006, Empirical Software Engineering.

[9]  Guy L. Steele,et al.  The Java Language Specification , 1996 .