Font Size: a A A

Identification And Analysis Of Extract Method Refactorings

Posted on:2016-04-19Degree:MasterType:Thesis
Country:ChinaCandidate:Y LiuFull Text:PDF
GTID:2308330476455008Subject:Software engineering
Abstract/Summary:PDF Full Text Request
Software refactoring is an effective means to improve software readability and maintainability by restructuring its internal structures without changing the external behavior. Automatic identification of software refactoring refers to finding refactoring operations that have been executed by analyzing and comparing evolutionary history of code after refactoring. Identification of software refactoring can help software maintenance personnel have a better understanding of the software development history, and thus maintain the software more effectively.Extract method is one of the most popular refactorings. It can be used in different scenarios such as break down long method, eliminate duplicate code. However, there is no empirical research on how often extract method is used for different reasons. Due to different usage scenarios require different refactoring positioning and refactoring recommending technology, digging into this issue might help researcher to improve refactoring support for extract method, e.g., proposing better approaches and tools to recommend refactoring opportunities of extract method, and proposing better tools to select fragments to be extracted.To this end, we propose an automatic detection algorithm of extract method refactoring,and use this algorithm to find a number of extract method refactoring to study how often extract method is used under different scenarios. Detection algorithm of extract method is implemented as an Eclipse plug-in project to detect extract method refactoring between adjacent versions of the software. Experiments were conducted in seven large-scale open source projects and the number of extract method we detect is 1619, the average precision rate can reach 82%. We statistically analyzed the detected experimental data, and experimental results show that only 27.7% of extract method refactorings are conducted to shorten long functions, 16.2% are conducted to remove duplicate code, and up to 56% are conducted to facilitate immediate reuse while implementing new requirements. These findings might suggest that recommending extract method opportunities by detecting long method and duplicate code alone might miss many extract method opportunities. Thesefindings also suggest that which fragments should be extracted often depends on new requirements, and thus requirements-driven extract method refactoring might be a potential research issue.
Keywords/Search Tags:Software Refactoring, Extract Method, The detection of Software Refactorings, Automated tool of Extract Method
PDF Full Text Request
Related items