TY - GEN
T1 - Identifying fragments to be extracted from long methods
AU - Yang, Limei
AU - Liu, Hui
AU - Niu, Zhendong
PY - 2009
Y1 - 2009
N2 - Long and complex methods are hard to read or maintain, and thus usually treated as bad smells, known as Long Method. On the contrary, short and well-named methods are much easier to read, maintain, and extend. In order to divide long methods into short ones, refactoring Extract Method was proposed and has been widely used. However, extracting methods manually is time consuming and error prone. Though existing refactoring tools can automatically extract a selected fragment from its inclosing method, which fragment within a long method should be extracted has to be determined manually. In order to facilitate the decision-making, we propose an approach to recommend fragments within long methods for extraction. The approach is implemented as a prototype, called AutoMeD. With the tool, we evaluate the approach on a nontrivial open source project. The evaluation results suggest that refactoring cost of long methods can be reduced by nearly 40%. The main contribution of this paper is an approach to recommending fragments within long methods to be extracted, as well as an initial evaluation of the approach.
AB - Long and complex methods are hard to read or maintain, and thus usually treated as bad smells, known as Long Method. On the contrary, short and well-named methods are much easier to read, maintain, and extend. In order to divide long methods into short ones, refactoring Extract Method was proposed and has been widely used. However, extracting methods manually is time consuming and error prone. Though existing refactoring tools can automatically extract a selected fragment from its inclosing method, which fragment within a long method should be extracted has to be determined manually. In order to facilitate the decision-making, we propose an approach to recommend fragments within long methods for extraction. The approach is implemented as a prototype, called AutoMeD. With the tool, we evaluate the approach on a nontrivial open source project. The evaluation results suggest that refactoring cost of long methods can be reduced by nearly 40%. The main contribution of this paper is an approach to recommending fragments within long methods to be extracted, as well as an initial evaluation of the approach.
KW - Bad smells
KW - Extract method
KW - Long method
KW - Refactoring
UR - http://www.scopus.com/inward/record.url?scp=76349091824&partnerID=8YFLogxK
U2 - 10.1109/APSEC.2009.20
DO - 10.1109/APSEC.2009.20
M3 - Conference contribution
AN - SCOPUS:76349091824
SN - 9780769539096
T3 - Proceedings - Asia-Pacific Software Engineering Conference, APSEC
SP - 43
EP - 49
BT - Proceedings - 16th Asia-Pacific Software Engineering Conference, APSEC 2009
T2 - 16th Asia-Pacific Software Engineering Conference, APSEC 2009
Y2 - 1 December 2009 through 3 December 2009
ER -