arrow
Return

Automated pattern-directed refactoring for complex conditional statements

delete2014-05-15
delete5
PRE
AI
刘玮 cover
刘玮 (Wei Liu)
Z
Zhigang Hu *
刘洪涛 (Hongtao Liu)
Y
Yang Liu
DOI:10.1007/s11771-014-2140-zdelete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional statements are selected, and they are the factory method pattern and the strategy pattern. Two pattern-directed refactoring approaches based on the two design patterns are proposed. Each approach contains a refactoring opportunities identification algorithm and an automated refactoring algorithm. After parsing the abstract syntax tree generated from source code, the refactoring opportunities are identified effectively and automatically. Then, for candidate code, refactoring algorithms are executed automatically, which are used to simplify or remove complex conditional statements. By empirical analysis and quality assessment, the code after refactoring has better maintainability and extensibility, and the proposed approach for automated pattern-directed refactoring succeeds to reduce code size and complexity of classes.
Keywords:
refactoring
abstract syntax tree
complex conditional statements
design patterns
factory method pattern
strategy pattern

Journal

Journal of Central South University cover
Journal of Central South University
IF:
4.4
Papers:
5.2K
Citations:
1.0W

Organization

C
Central South University
Scholars:
10.0W
Papers: 7.2W
Citations: 10.9W
Cited Papers

Cited Papers

Identification of refactoring opportunities introducing polymorphism
err2010-03-01
err41
PREAI
errTsantalis, Nikolaos; Chatzigeorgiou, Alexander
errShare
errSave
Identification of Move Method Refactoring Opportunities
err2009-05-01
err274
PREAI
errTsantalis, Nikolaos; Chatzigeorgiou, Alexander
errShare
errSave
How We Refactor, and How We Know It
err2012-01-01
err327
PREAI
errMurphy-Hill, Emerson; Parnin, Chris; Black, Andrew P.
errShare
errSave
A 1-V Supply a-InGaZnO-Based Voltage Reference With Enhancement- and Depletion-Mode Thin-Film Transistors
err2022-11-01
err0
PREAI
errGuangan Yang; Hao Tian; Zuoxu Yu; Tingrui Huang; Yong Xu; Huabin Sun; Weifeng Sun; Wangran Wu
errShare
errSave
Automated refactoring to the Strategy design pattern
err2012-11-01
err29
PREAI
errChristopoulou, Aikaterini; Giakoumakis, E. A.; Zafeiris, Vassilis E.; Soukara, Vasiliki
errShare
errSave
researcher View more