简介概要

Automated pattern-directed refactoring for complex conditional statements

来源期刊:中南大学学报(英文版)2014年第5期

论文作者:刘伟 胡志刚 LIU Hong-tao(刘宏韬) YANG Liu(杨柳)

文章页码:1935 - 1945

Key words:refactoring; abstract syntax tree; complex conditional statements; design patterns; factory method pattern; strategy pattern

Abstract: 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.

详情信息展示

Automated pattern-directed refactoring for complex conditional statements

LIU Wei(刘伟)1, HU Zhi-gang(胡志刚)1,2, LIU Hong-tao(刘宏韬)2, YANG Liu(杨柳)2

(1. School of Information Science and Engineering, Central South University, Changsha 410083, China;
2. School of Software, Central South University, Changsha 410075, China)

Abstract: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.

Key words:refactoring; abstract syntax tree; complex conditional statements; design patterns; factory method pattern; strategy pattern

<上一页 1 下一页 >

相关论文

  • 暂无!

相关知识点

  • 暂无!

有色金属在线官网  |   会议  |   在线投稿  |   购买纸书  |   科技图书馆

中南大学出版社 技术支持 版权声明   电话:0731-88830515 88830516   传真:0731-88710482   Email:administrator@cnnmol.com

互联网出版许可证:(署)网出证(京)字第342号   京ICP备17050991号-6      京公网安备11010802042557号