计算机科学 ›› 2022, Vol. 49 ›› Issue (11): 55-64.doi: 10.11896/jsjkx.220300058
郭亚琳, 李晓晨, 任志磊, 江贺
GUO Ya-lin, LI Xiao-chen, REN Zhi-lei, JIANG He
摘要: 随着软件不断迭代发展,软件维护成本也相应增加。自动化重构可以降低软件维护成本,基于搜索的重构方法是解决该问题最典型的方法之一。其中目标的选择对搜索过程起决定性作用,质量目标与非质量目标都是开发人员在重构时通常会考虑的目标。然而,尚未有研究系统地分析在相同的评价环境下,哪些目标更有利于代码重构,特别是得到符合开发者预期的代码重构结果;并且也未分析质量目标与常用的非质量目标进行组合是否会有更好的效果。文中提出了基于搜索的多目标软件重构方法,探索了7个不同目标的组合对软件重构质量的影响。在6个规模不同的开源软件项目上进行了验证,应用多种指标对重构前后软件质量进行评估,并分析了不同优化目标组合的表现。实验结果表明,质量目标与非质量目标组合比单独使用质量目标组合对重构效果的提升更明显,其中质量目标与之前重构记录的一致性的组合对重构有较好的提升效果。
中图分类号:
[1]BROWN W H,MALVEAU R C,MCCOR-MICK H W S,et al.AntiPatterns:refactoring software,architectures,and projects in crisis [M].John Wiley & Sons,Inc.,1998. [2]ERLIKH L.Leveraging legacy system dollars for e-business[J].IT Professional,2000,2(3):17-23. [3]BELL D.Software Engineering:A Programming Approach[M].Hoboken:Addison Wesley,2000. [4]OPDYKE W,JOHNSON R.Refactoring:An Aid in DesigningApplication Frameworks and Evolving Object-Oriented Systems[C]//Proceedings of the Symposium on Object Oriented Programming Emphasizing Practical Applications(Sooppa’90 ).1990:145-161. [5]MKAOUER M W,KESSENTINI M,BECH-IKH S,et al.High dimensional search-based software engineering:finding tradeoffs among 15 objectives for automating software refactoring using NSGA-III[C]//Proceedings of the 2014 Annual Conference on Genetic and Evolutionary Computation.2014:1263-1270. [6]OUNI A,KESSENTINI M,SAHRAOUI H,et al.Multi-criteria code refactoring using search-based software engineering:An industrial case study [J].ACM Transactions on Software Engineering and Methodology(TOSEM),2016,25(3):1-53. [7]MOHAN M,GREER D.A survey of search-based refactoring for software maintenance[J].Journal of Software Engineering Research and Development,2018,6(1):1-52. [8]WU N,SONG F M,LI X D.Quantum search-based software engineering:An exploratory study[J].SCIENTIA SINICA Informationis,2015,45(5):623-633. [9]MARIANI T,VERGILIO S R.A systematic review on search-based refactoring[J].Information and Software Technology,2017,83:14-34. [10]OUNI A,KESSENTINI M,SAHRAOUI H,et al.Maintain-ability defects detection and correction:A multi-objective approach [J].Automated Software Engineering,2013,20(1):47-79. [11]ALIZADEH V,KESSENTINI M,MKAOU-ER M W,et al.An interactive and dynamic search-based approach to software refactoring recommenda-tions[J].IEEE Transactions on Software Engineering,2018,46(9):932-961. [12]MENS T,TOURWE T.A survey of software refactoring[J].IEEE Transactions on Software Engineering,2004,30(2):126-139. [13]FOWLER M.Refactoring:improving the design of existing code[M].Hoboken:Addison-Wesley Professional,2018. [14]SENG O,STAMMEL J,BURKHART D.Search-based determination of refactorings for improving the class structure of object-oriented systems[C]//Proceedings of the 8th Annual Conferen-ce on Genetic and Evolutionary Computation.2006:1909-1916. [15]KESSENTINI M,KESSENTINI W,SAHRA-OUI H,et al.Design defects detection and correction by example[C]//2011 IEEE 19th International Conference on Program Comprehension.IEEE,2011:81-90. [16]PRADITWONG K,HARMAN M,YAO X.Software moduleclustering as a multi-objective search problem[J].IEEE Transa-ctions on Software Engineering,2010,37(2):264-282. [17]HARMAN M,HIERONS R M,PROCTOR M.A New Representation and Crossover Operator for Search-based Optimization of Software Modularization [C]//GECCO.2002:1351-1358. [18]BAVOTA G,CARNEVALE F,DE LUCIA A,et al.Putting the developer in-the-loop:an interactive GA for software remodula-rization[C]//International Symposium on Search Based Software Engineering.Berlin:Springer,2012:75-89. [19]OUNI A,KESSENTINI M,SAHRAOUI H,et al.The use of development history in software refactoring using a multi-objective evolutionary algorithm[C]//Proceedings of the 15th annual conference on Genetic and evolutionary computation.2013:1461-1468. [20]BANSIYA J,DAVIS C G.A hierarchical model for object-oriented design quality assessment [J].IEEE Transactions on Software Engineering,2002,28(1):4-17. [21]O’KEEFFE M,CINNÉIDE M O.Search-based refactoring for software maintenance[J].Journal of Systems and Software,2008,81(4):502-516. [22]MOHAN M,GREER D.Using a Many-Objective Approach to Investigate Automated Refactoring [J].Information & Software Technology,2019,112:83-101. [23]FERNANDES E,CHÁVEZ A,GARCIA A,et al.Refactoring effect on internal quality attributes:What haven’t they told you yet? [J].Information and Software Technology,2020,126:106347. [24]ABID C,KESSENTINI M,ALIZADEH V,et al.How DoesRefactoring Impact Security When Improving Quality?A Security-Aware Refactoring Approach[J].IEEE Transactions on Software Engineering,2022,48(3):864-878. [25]OUNI A,KESSENTINI M,SAHRAOUI H,et al.Improvingmulti-objective code-smells correction using development history[J].Journal of Systems and Software,2015,105:18-39. [26]MKAOUER M W,KESSENTINI M,BECHIKH S,et al.Recom- mendation system for software refactoring using innovization and interactive dynamic optimization[C]//Proceedings of the 29th ACM/IEEE International Conference on Automated Soft-ware Engineering.2014:331-336. [27]JENSEN A C,CHENG B H C.On the use of genetic programming for automated refactoring and the introduction of design patterns[C]//Proceedings of the 12th Annual Conference on Genetic and Evolutionary Computation.2010:1341-1348. [28]MKAOUER W,KESSENTINI M,SHAOUT A,et al.Many-objective software remodularization using NSGA-III [J].ACM Transactions on Software Engineering and Methodology(TOSEM),2015,24(3):1-45. [29]GHANNEM A,BOUSSAIDI G E,KESSENTINI M.Modelrefactoring using interactive genetic algorithm[C]//Interna-tional Symposium on Search Based Software Engineering.Berlin:Springer,2013:96-110. [30]ABID C,ALIZADEH V,KESSENTINI M,et al.Prioritizingrefactorings for security-critical code[J].Automated Software Engineering,2021,28(2):1-28. [31]KESSENTINI M,KESSENTINI W,SAHRA-OUI H,et al.Design defects detection and correction by example[C]//2011 IEEE 19th International Conference on Program Comprehension.IEEE,2011:81-90. [32]DEB K,SAXENA D.Searching for Pareto-optimal solutionsthrough dimensionality reduction for certain large-dimensional multi-objective optimization problems[C]//Proceedings of the World Congress on Computational Intelligence(WCCI-2006).2006:3352-3360. |
[1] | 熊罗庚, 郑尚, 邹海涛, 于化龙, 高尚. 融合双向门控循环单元和注意力机制的软件自承认技术债识别方法 Software Self-admitted Technical Debt Identification with Bidirectional Gate Recurrent Unit and Attention Mechanism 计算机科学, 2022, 49(7): 212-219. https://doi.org/10.11896/jsjkx.210500075 |
[2] | 孙刚, 伍江江, 陈浩, 李军, 徐仕远. 一种基于切比雪夫距离的隐式偏好多目标进化算法 Hidden Preference-based Multi-objective Evolutionary Algorithm Based on Chebyshev Distance 计算机科学, 2022, 49(6): 297-304. https://doi.org/10.11896/jsjkx.210500095 |
[3] | 李浩东, 胡洁, 范勤勤. 基于并行分区搜索的多模态多目标优化及其应用 Multimodal Multi-objective Optimization Based on Parallel Zoning Search and Its Application 计算机科学, 2022, 49(5): 212-220. https://doi.org/10.11896/jsjkx.210300019 |
[4] | 彭冬阳, 王睿, 胡谷雨, 祖家琛, 王田丰. 视频缓存策略中QoE和能量效率的公平联合优化 Fair Joint Optimization of QoE and Energy Efficiency in Caching Strategy for Videos 计算机科学, 2022, 49(4): 312-320. https://doi.org/10.11896/jsjkx.210800027 |
[5] | 张久杰, 陈超, 聂宏轩, 夏玉芹, 张丽萍, 马占飞. 基于类粒度的克隆代码群稳定性实证研究 Empirical Study on Stability of Clone Code Sets Based on Class Granularity 计算机科学, 2021, 48(5): 75-85. https://doi.org/10.11896/jsjkx.200900062 |
[6] | 米庆, 郭黎敏, 陈军成. 基于多维度特征和混合神经网络的代码可读性评估方法 Code Readability Assessment Method Based on Multidimensional Features and Hybrid Neural Networks 计算机科学, 2021, 48(12): 94-99. https://doi.org/10.11896/jsjkx.200800193 |
[7] | 王珂, 曲桦, 赵季红. 多域SFC部署中基于强化学习的多目标优化方法 Multi-objective Optimization Method Based on Reinforcement Learning in Multi-domain SFC Deployment 计算机科学, 2021, 48(12): 324-330. https://doi.org/10.11896/jsjkx.201100159 |
[8] | 崔国楠, 王立松, 康介祥, 高忠杰, 王辉, 尹伟. 结合多目标优化算法的模糊聚类有效性指标及应用 Fuzzy Clustering Validity Index Combined with Multi-objective Optimization Algorithm and Its Application 计算机科学, 2021, 48(10): 197-203. https://doi.org/10.11896/jsjkx.200900061 |
[9] | 朱汉卿, 马武彬, 周浩浩, 吴亚辉, 黄宏斌. 基于改进多目标进化算法的微服务用户请求分配策略 Microservices User Requests Allocation Strategy Based on Improved Multi-objective Evolutionary Algorithms 计算机科学, 2021, 48(10): 343-350. https://doi.org/10.11896/jsjkx.201100009 |
[10] | 张清琪, 刘漫丹. 复杂网络社区发现的多目标五行环优化算法 Multi-objective Five-elements Cycle Optimization Algorithm for Complex Network Community Discovery 计算机科学, 2020, 47(8): 284-290. https://doi.org/10.11896/jsjkx.190700082 |
[11] | 郑友莲, 雷德明, 郑巧仙. 求解高维多目标调度的新型人工蜂群算法 Novel Artificial Bee Colony Algorithm for Solving Many-objective Scheduling 计算机科学, 2020, 47(7): 186-191. https://doi.org/10.11896/jsjkx.190600089 |
[12] | 赵松辉, 任志磊, 江贺. 软件升级问题的多目标优化方法 Multi-objective Optimization Methods for Software Upgradeability Problem 计算机科学, 2020, 47(6): 16-23. https://doi.org/10.11896/jsjkx.200400027 |
[13] | 夏春艳, 王兴亚, 张岩. 基于多目标优化的测试用例优先级排序方法 Test Case Prioritization Based on Multi-objective Optimization 计算机科学, 2020, 47(6): 38-43. https://doi.org/10.11896/jsjkx.191100113 |
[14] | 孙敏, 陈中雄, 叶侨楠. 云环境下基于HEDSM的工作流调度策略 Workflow Scheduling Strategy Based on HEDSM Under Cloud Environment 计算机科学, 2020, 47(6): 252-259. https://doi.org/10.11896/jsjkx.190400047 |
[15] | 孟繁祎, 王莹, 于海, 朱志良. 复杂软件系统的重构技术:现状、问题与展望 Refactoring of Complex Software Systems Research:PresentProblem and Prospect 计算机科学, 2020, 47(12): 1-10. https://doi.org/10.11896/jsjkx.200800067 |
|