Multi-Criteria Code Refactoring Using Search-Based Software Engineering: An Industrial Case Study

被引:102
作者
Ouni, Ali [1 ]
Kessentini, Marouane [2 ]
Sahraoui, Houari [3 ]
Inoue, Katsuro [1 ]
Deb, Kalyanmoy [4 ]
机构
[1] Osaka Univ, Suita, Osaka 565, Japan
[2] Univ Michigan Dearborn, Dearborn, MI USA
[3] Univ Montreal, Montreal, PQ H3C 3J7, Canada
[4] Michigan State Univ, E Lansing, MI 48824 USA
基金
日本学术振兴会;
关键词
Search-based software engineering; refactoring; software maintenance; multi-objective optimization; software evolution; DESIGN QUALITY; BAD SMELLS; IDENTIFICATION; OPPORTUNITIES;
D O I
10.1145/2932631
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
One of the most widely used techniques to improve the quality of existing software systems is refactoring-the process of improving the design of existing code by changing its internal structure without altering its external behavior. While it is important to suggest refactorings that improve the quality and structure of the system, many other criteria are also important to consider, such as reducing the number of code changes, preserving the semantics of the software design and not only its behavior, and maintaining consistency with the previously applied refactorings. In this article, we propose a multi-objective search-based approach for automating the recommendation of refactorings. The process aims at finding the optimal sequence of refactorings that (i) improves the quality by minimizing the number of design defects, (ii) minimizes code changes required to fix those defects, (iii) preserves design semantics, and (iv) maximizes the consistency with the previously code changes. We evaluated the efficiency of our approach using a benchmark of six open-source systems, 11 different types of refactorings (move method, move field, pull up method, pull up field, push down method, push down field, inline class, move class, extract class, extract method, and extract interface) and six commonly occurring design defect types (blob, spaghetti code, functional decomposition, data class, shotgun surgery, and feature envy) through an empirical study conducted with experts. In addition, we performed an industrial validation of our technique, with 10 software engineers, on a large project provided by our industrial partner. We found that the proposed refactorings succeed in preserving the design coherence of the code, with an acceptable level of code change score while reusing knowledge from recorded refactorings applied in the past to similar contexts.
引用
收藏
页数:53
相关论文
共 89 条
[1]   Identifying refactoring opportunities in object-oriented code: A systematic literature review [J].
Al Dallal, Jehad .
INFORMATION AND SOFTWARE TECHNOLOGY, 2015, 58 :231-249
[2]   RefDistiller: A Refactoring Aware Code Review Tool for Inspecting Manual Refactoring Edits [J].
Alves, Everton L. G. ;
Song, Myoungkyu ;
Kim, Miryung .
22ND ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (FSE 2014), 2014, :751-754
[3]  
Amaro R, 2006, LECT NOTES COMPUT SC, V3878, P28
[4]  
[Anonymous], 2014, SOFTWARE METRICS RIG
[5]  
[Anonymous], 1998, AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis
[6]  
[Anonymous], 2014, P 29 ACM IEEE INT C
[7]   Legacy Software Restructuring: Analyzing a Concrete Case [J].
Anquetil, Nicolas ;
Laval, Jannik .
2011 15TH EUROPEAN CONFERENCE ON SOFTWARE MAINTENANCE AND REENGINEERING (CSMR), 2011, :279-286
[8]  
Baar T, 2007, LECT NOTES COMPUT SC, V4378, P70
[9]   A hierarchical model for object-oriented design quality assessment [J].
Bansiya, J ;
Davis, CG .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2002, 28 (01) :4-17
[10]  
Bavota G., 2014, Recommendation Systems in Software Engineering, P387