计算机科学 ›› 2020, Vol. 47 ›› Issue (12): 1-10.doi: 10.11896/jsjkx.200800067
所属专题: 复杂系统的软件工程和需求工程
孟繁祎, 王莹, 于海, 朱志良
MENG Fan-yi, WANG Ying, YU Hai, ZHU Zhi-liang
摘要: 软件重构是改善软件质量的一种重要手段它在不改变软件外部行为特性的情况下通过调整软件内部结构来提高软件的可理解性、可维护性和可扩展性.然而随着开源软件的迅猛发展软件的规模和复杂程度日益增加现有的重构技术在应对规模庞大且复杂的软件系统时重构效果并不如意.因此提高重构技术的可扩展性一直是软件工程领域研究的热点.从技术负债角度出发探究重构时机思考重构技术对软件质量的深入影响明确重构技术旨在寻找重构代码的自动化方法从而降低维护成本提高代码质量.文中对工程实例进行分析并对文献进行梳理调研了自2010年至今国内外96篇相关领域的文献尝试以复杂系统的视角对这些研究工作进行归纳、比较提炼总结软件重构领域的研究方向与技术方法探讨重构技术研究中的特点与难点思考重构技术研究中存在的问题及未来的研究方向对软件重构技术的研究趋势进行了展望.
中图分类号:
[1] FOWLER M,BECK K,BRANT J,et al.Refactoring:improving the design of existing code[M].California:Addison-Wesley Professional,1999. [2] CODABUX Z,WILLIAMS B.Managing technical debt:An industrial case study[C]//International Workshop on Managing Technical Debt (MTD 13).New York:IEEE,2013:8-15. [3] CUNNINGHAM W.The WyCash portfolio management system[J].ACM Sigplan Oops Messenger,1992,4(2):29-30. [4] BEHUTIYE W N,RODRÍGUEZ P,OIVO M,et al.Analyzing the concept of technical debt in the context of agile software development:A systematic literature review[J].Information &Software Technology ,2017,82:139-158. [5] BESKER T,MARTINI A,BOSCH J.Managing architecturaltechnical debt:A unied model and systematic literature review[J].Journal of Systems &Software,2018,135:1-16. [6] LI Z,AVGERIOU P,LIANG P.A systematic mapping study on technical debt and its management[J].Journal of Systems and Software,2015,101(3):193-220. [7] DALLAL J A,ABDIN A.Empirical Evaluation of the Impact of Object-Oriented Code Refactoring on Quality Attributes:A Systematic Literature Review[J].IEEE Transactions on Software Engineering,2018,44(1):44-69. [8] MOHAN M,GREER D.A survey of search-based refactoring for software maintenance[J].Journal of Software Engineering Research &Development,2018,6(1):3. [9] DALLAL J A.Identifying refactoring opportunities in object-oriented code:A systematic literature review[J].Information &Software Technology ,2015,58:231-249. [10] TUFANO M,PALOMBA F,BAVOTA G,et al.When and Why Your Code Starts to Smell Bad (and Whether the Smells Go Away)[J].IEEE Transactions on Software Engineering,2017,43(11):1063-1088. [11] LACERDA G,PETRILLO F,PIMENTA M,et al.Code Smells and Refactoring:A Tertiary Systematic Review of Challenges and Observations[J].Journal of Systems and Software,2020,167:110610. [12] MARINESCU R,GANEA G,VEREBI I.InCode:ContinuousQuality Assessment and Improvement[C]//European Conference on Software Maintenance &Reengineering (CSMR 10).LOS ALAMITOS:IEEE Computer Society,2010:274-275. [13] VEERAPPA V,HARRISON R.An Empirical Validation ofCoupling Metrics Using Automated Refactoring[C]//ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM 13).Los Alamitos:IEEE Computer Society,2013:271-274. [14] FARD A M,MESBAH A.JSNOSE:Detecting JavaScript Code Smells[C]//International Working Conference on Source CodAnalysis and Manipulation (SCAM 13).Los Alamitos:IEEE Computer Society,2013:116-125. [15] CHEN Z F,CHEN L,MA W W Y,et al.Understanding metric-based detectable smells in Python software:A comparative study[J].Information &Software Technology ,2018,94:14-29. [16] JIANG D X,MA P J,SU X H,et al.Detection and refactoring of bad smell caused by large scale[J].International Journal of Software Engineering &Applications,2013,4(5):1-13. [17] CARVALHO S G,ANICHE M,VERÉSSIMO J,et al.An Empirical Catalog of Code Smells for the Presentation Layer of Android Apps[J].Empirical Software Engineering,2019,24(6):3546-3586. [18] MOHA N,GUEHENEUC Y G,DUCHIEN L,et al.DECOR:A Method for the Specification and Detection of Code and Design Smells[J].IEEE Transactions on Software Engineering,2010,36(1):20-36. [19] BARBEZ A,KHOMH F,GUÉHÉNEUC Y G.A Machine-learning Based Ensemble Method For Anti-patterns Detection[J].Journal of Systems and Software,2020,161:110486. [20] BARBEZ A,KHOMH F,GUÉHÉNEUC Y G.Deep LearningAnti-patterns from Code Metrics History[C]//IEEE International Conference on Software Maintenance and Evolution (ICSME 19).New York:IEEE,2019:114-124. [21] PALOMBA F,BAVOTA G,PENTA M D,et al.Detecting bad smells in source code using change history information[C]//IEEE/ACM International Conference on Automated Software Engineering (ASE 13).New York:IEEE,2013,268-278. [22] PALOMBA F,BAVOTA G,PENTA M D,et al.Mining Version Histories for Detecting Code Smells[J].IEEE Transactions on Software Engineering,2015,41(5):462-489. [23] FONTANA F A,MÄNTYLÄM V,ZANONI M,et al.Comparing and experimenting machine learning techniques for code smell detection[J].Empirical Software Engineering,2016,21(3):1143-1191. [24] FONTANA F A,ZANONI M,MARINO A,et al.Code Smell Detection:Towards a Machine Learning-Based Approach[C]//IEEE International Conference on Software Maintenance (ICSM 13).New York:IEEE,2013:396-399. [25] FONTANA F A,ZANONI M.Code smell severity classification using machine learning techniques[J].Empirical Software Engineering,2017,128:43-58. [26] NUCCI D D,PALOMBA F,TAMBURRI D A,et al.Detecting code smells using machine learning techniques:Are we there yet?[C]//IEEE International Conference on Software Analysis,Evolution and Reengineering (SANER 18).New York:IEEE,2018:612-621. [27] STEINBECK M.An arc-based approach for visualization of code smells[C]//IEEE International Conference on Software Analysis,Evolution and Reengineering (SANER 17).New York:IEEE,2017:397-401. [28] MUMTAZ H,BECK F,WEISKOPF D.Detecting Bad Smells in Software Systems with Linked Multivariate Visualizations[C]//IEEE Working Conference on Software Visualization (VISSOFT 18).Los Alamitos:IEEE Computer Society,2018:12-20. [29] MARIANI T,VERGILIO S R.A systematic review on search-based refactoring[J].Information &Software Technology ,2017,83:14-34. [30] BAQAIS A A B,ALSHAYEB M.Automatic software refacto-ring:a systematic literature review[J].Software Quality Journal,2020,28(2):459-502. [31] MISBHAUDDIN M,ALSHAYEB M.UML model refactoring:a systematic literature review[J].Empirical Software Enginee-ring,2015,20(1):206-251. [32] SENG O,STAMMEL J,BURKHART D.Search-based determination of refactorings for improving the class structure of object- oriented systems[C]//Genetic and Evolutionary Computation Conference (GECCO 06).New York:ASSOC Computing Machinery,2006:1909-1916. [33] 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. [34] KEBIR S,BORNE I,MESLATI D.A Genetic Algorithm-Based Approach for Automated Refactoring of Component-Based Software[J].Information &Software Technology ,2018,88:17-36. [35] 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. [36] ALKHAZI B,ABID C,KESSENTINI M,et al.On the Value of Quality Attributes for Refactoring ATL Model Transformations:A Multi-Objective Approach[J].Information &Software Technology ,2020,120:106243. [37] PRADITWONG K,HARMAN M,YAO X.Software ModuleClustering as a Multi-Objective Search Problem[J].IEEE Transactions on Software Engineering,2011,37(2):264-282. [38] KESSENTINI M,DEA T J,OUNI A.A context-based refactoring recommendation approach using simulated annealing:two industrial case studies[C]//Genetic and Evolutionary Computation Conference (GECCO 17).2017:1303-1310. [39] KESSENTINI M,MANSOOR U,WIMMER M,et al.Search-based detection of model level changes[J].Empirical Software Engineering,2016,22(2):1-46. [40] AMAL B,KESSENTINI M,BECHIKH S,et al.On the use of machine learning and search-based software engineering for ill-defined fitness function:A case study on software refactoring[C]//International Symposium on Search-Based Software Engineering (SSBSE 14).2014:31-45. [41] DEA T J.Improving the performance of many-objective soft-ware refactoring technique using dimensionality reduction[C]//International Symposium on Search-Based Software Engineering (SSBSE 16).2016:298-303. [42] MKAOUER M W,KESSENTINI M,BECHIKH S,et al.On the use of many quality attributes for software refactoring:a many-objective search-based software engineering approach[J].Empirical Software Engineering,2016,21(6):2503-2545. [43] MOHAN M,GREER D.Using a Many-Objective Approach to Investigate Automated Refactoring[J].Information &Software Technology ,2019,112:83-101. [44] BOUKHARATA S,OUNI A,KESSENTINI M,et al.Improving web service interfaces modularity using multi-objective optimization[J].Automated Software Engineering,2019,26(2):275-312. [45] GRIFFITH I,WAHL S,IZURIETA C.Evolution of legacy system comprehensibility through automated refactoring[C]//International Workshop on Machine Learning Technologies in Software Engineering (MALETS 11).New York:ACM,2011:35-42. [46] GRIFFITH I,WAHL S,IZURIETA C.TrueRefactor:An automated refactoring tool to improve legacy system and application comprehensibility[C]//International Conference on Computer Applications in Industry and Engineering(CAINE 11).Cary:International Society for Computers and Their Applications,2011:316-321. [47] OUNI A,KESSENTINI M,SAHRAOUI H.Search-BasedRefactoring Using Recorded Code Changes[C]//European Conference on Software Maintenance &Reengineering (CSMR 13).New York:IEEE,2013:221-230. [48] JENSEN A C,CHENG B H C.On the Use of Genetic Programming for Automated Refactoring and the Introduction of Design Patterns[C]//Genetic and Evolutionary Computation Conference (GECCO 10).New York:ACM,2010:1341-1348. [49] BRAMBILLA M,CABOT J,WIMMER M.Model-Driven Software Engineering in Practice[M].Morgan &Claypool,2012. [50] REIMANN J,SEIFERT M,AβMANN U.Role-Based Generic Model Refactoring[C]//International Conference on Model Driven Engineering Languages &Systems (MODELS 10).Berlin:Springer Verlag,2010:78-92. [51] STEIMANN F.From well-formedness to meaning preservation:model refactoring for almost free[J].Software and systems modeling,2015,14(1):307-320. [52] ARCELLI D,CORTELLESSA V,POMPEO D.Performance-driven software model refactoring[J].Information &Software Technology ,2018,95:366-397. [53] EINARSSON H T,NEUKIRCHEN H.An approach and tool for synchronous refactoring of UML diagrams and models using model-to-model transformations[C]//Proceedings of the Fifth Workshop on Refactoring Tools(WRT 12).New York:ACM,2012:1-8. [54] ARCELLI D,CORTELLESSA V,POMPEO D D.AutomatingPerformance Antipattern Detection and Software Refactoring in UML Models[C]//IEEE International Conference on Software Analysis,Evolution and Reengineering (SANER 19).New York:IEEE,2019:639-643. [55] LU H,WANG S,YUE T,et al.Automated Refactoring of OCL Constraints with Search[J].IEEE Transactions on Software Engineering,2019,45(2):148-170. [56] BAVOTA G,OLIVETO R,GETHERS M,et al.Methodbook:Recommending move method refactorings via relational topic models[J].IEEE Transactions on Software Engineering,2014,40(7):671-694. [57] BAVOTA G,DE LUCIA A,OLIVETO R.Identifying extract class refactoring opportunities using structural and semantic cohesion measures[J].Journal of Systems and Software,2011,84(3):397-414. [58] MUMTAZ H,ALSHAYEB M,MAHMOOD S,et al.An empirical study to improve software security through the application of code refactoring[J].Information &Software Technology ,2018,96(4):112-125. [59] POLITOWSKI C,KHOMH F,ROMANO S,et al.A large scale empirical study of the impact of Spaghetti Code and Blob anti-patterns on program comprehension[J].Information &Software Technology ,2020,122:106278. [60] WANG Y,YU H,ZHU Z L,et al.Automatic Software Refactoring via Weighted Clustering in Method-Level Networks[J].IEEE Transactions on Software Engineering,2018,44(3):202-236. [61] BU Y F,LIU H,LI G J.God Class Detection Approach Based on Deep Learning[J].Journal ofSoftware,2019,30(5):1359-1374. [62] LIU H,MA Z,SHAO W,et al.Schedule of Bad Smell Detection and Resolution:A New Way to Save Effort[J].IEEE Transactions on Software Engineering,2012,38(1):220-235. [63] LIU H,LIU Q,NIU Z,et al.Dynamic and Automatic Feedback-Based Threshold Adaptation for Code Smell Detection[J].IEEE Transactions on Software Engineering,2016,42(6):544-558. [64] OLIVEIRA M C D,FREITAS D,BONIFÁCIO R,et al.Finding needles in a haystack:Leveraging co-change dependencies to recommend refactorings[J].Journal of Systems and Software,2019,158:110420. [65] SAS D,AVGERIOU P,FONTANA F A.Investigating instability architectural smells evolution:an exploratory case study[C]//IEEE International Conference on Software Maintenance and Evolution (ICSME 19).New York:IEEE,2019:557-567. [66] PALOMBA F,NUCCI D D,PANICHELLA A,et al.On the impact of code smells on the energy consumption of mobile applications[J].Information &Software Technology ,2019,105:43-55. [67] XUAN J F,CORNU B,MARTINEZ M,et al.B-Refactoring:Automatic test code refactoring to improve dynamic analysis[J].Information &Software Technology ,2016,76:65-80. [68] GAO Y,LIU H,FAN X Z,et al.Analyzing Refactorings'Impact on Regression Test Cases[C]//International Computer Software and Applications Conference (COMPSAC 15).New York:IEEE,2015:222-231. [69] CHU P H,HSUEH N L,CHEN H H,et al.A test case refactoring approach for pattern-based software development[J].Software Quality Journal,2012,20(1):43-75. [70] CHOWDHURY I,ZULKERNINE M.Using complexity,cou-pling,and cohesion metrics as early indicators of vulnerabilities[J].Journal of Systems Architecture,2011,57(3):294-313. [71] KHATCHADOURIAN R,MASUHARA H.Defaultificationrefactoring:A tool for automatically converting Java methods to default[C]//IEEE/ACM International Conference on Automated Software Engineering(ASE 17).New York:IEEE,2017:984-989. [72] LIN Y,DIG D.Refactorings for Android Asynchronous Pro-gramming[C]//IEEE/ACM International Conference on Automated Software Engineering (ASE 16).New York:IEEE,2016:836-841. [73] LIN Y,OKUR S,DIG D.Study and Refactoring of Android Asynchronous Programming[C]//IEEE/ACM International Conference on Automated Software Engineering (ASE 15).New York:IEEE,2015:224-235. [74] GE X,DUBOSE Q L,MURPHY-HILL E.Reconciling manual and automatic refactoring[C]//International Conference on Software Engineering (ICSE 12).New York:IEEE,2012:211-221. [75] FOSTER S R,GRISWOLD W G,LERNER S.WitchDoctor:IDE support for real-time auto-completion of refactorings[C]//International Conference on Software Engineering (ICSE 12).New York:IEEE,2012:222-232. [76] GYORI A,FRANKLIN L,DIG D,et al.Crossing the Gap from Imperative to Functional Programming Through Refactoring[C]//ACM SIGSOFT Symposium on the Foundation of Software Engineering/European Software Engineering Conference (ESEC/FSE 13).New York:ACM,2013:543-553. [77] SZOKE G,NAGY C,FULOP L J,et al.FaultBuster:An automatic code smell refactoring toolset[C]//IEEE International Working Conference on Source Code Analysis &Manipulation (SCAM 15).New York:IEEE,2015:253-258. [78] HAYASHI S,HOSHINO D,MATSUDA J,et al.Historef:ATool for Edit History Refactoring[C]//IEEE International Conference on Software Analysis,Evolution,and Reengineering (SANER 15).New York:IEEE,2015:469-473. [79] MAZINANIAN D,TSANTALIS N,STEIN R,et al.JDeodo-rant:Clone Refactoring[C]//International Conference on Software Engineering (ICSE 16).New York:IEEE,2016:613-616. [80] ANTEZANA A S.TOAD:a tool for recommending auto-refactoring alternatives[C]//International Conference on Software Engineering:Companion(ICSE-Companion 19).New York:IEEE,2019:174-176. [81] ALIZADEH V,OUALI M A,KESSENTINI M,et al.RefBot:Intelligent Software Refactoring Bot[C]//IEEE/ACM International Conference on Automated Software Engineering (ASE 19).New York:IEEE,2019:823-834. [82] SILVA D,SILVA J P,SANTOS G J D S,et al.RefDiff 2.0:A Multi-language Refactoring Detection Tool[J].IEEE Transactions on Software Engineering.DOI:10.1109/TSE.2020.2968072. [83] KIM M,GEE M,LOH A,et al.Ref-Finder:A refactoring reconstruction tool based on logic query templates[C]//International Symposium on Foundations of Software Engineering (FSE 10).New York:ACM,2010:71-372. [84] BAVOTA G,GETHERS M,OLIVETO R,et al.Improvingsoftware modularization via automated analysis of latent topics and dependencies[J].Acm Transactions on Software Enginee-ring &Methodology,2014,23(1):1-33. [85] LIU H,NIU Z,MA Z,et al.Identification of generalizationrefactoring opportunities[J].Automated Software Engineering,2012,20(1):81-110. [86] ZANETTI M S,TESSONE C J,SCHOLTES I,et al.Automated software remodularization based on move refactoring:a complex systems approach[C]//International Conference on Modularity (MODULARITY 14).New York:ACM,2014:73-84. [87] MKAOUER M W,KESSENTINI M,BECHIKH S,et al.Recommendation system for software refactoring using innovization and interactive dynamic optimization[C]//ACM/IEEE international conference on Automated software engineering(ASE 14).New York:IEEE,2014:331-336. [88] KRASNIQI R,CLELAND-HUANG J.Enhancing Source CodeRefactoring Detection with Explanations from Commit Messa- ges[C]//International Conference on Software Analysis,Evolution and Reengineering (SANER 20).New York:IEEE,2020:512-516. [89] HU Y,AHMED U Z,MECHTAEV S,et al.Re-Factoring Based Program Repair Applied to Programming Assignments[C]//International Conference on Automated Software Engineering (ASE 19).New York:IEEE,2019:388-398. [90] FENTON N E,PFLEEGER S L.Software Metrics:A Rigorous &Practical Approach[M].Boston:PWS Publishing Company,1997. [91] JABANGWE R,BÖRSTLER J,MITE D,et al.Empirical evidence on the link between:object-oriented measures and external quality attributes:A systematic literature review[J].Empirical Software Engineering.2015,20(3):640-693. [92] KANNANGARA S H,WIJAYANAYAKE W M J I.Impact of refactoring on external code quality improvement:An empirical evaluation[C]//International Conference on Advances in ICT for Emerging Regions (ICTer 13).New York:IEEE,2013:60-67. [93] ALSHAYEB M.The Impact of Refactoring to Patterns on Software Quality Attributes[J].Arabian Journal for ence &Engineering,2011,36(7):1241-1251. [94] ELISH K O,ALSHAYEB M.A Classification of RefactoringMethods Based on Software Quality Attributes[J].Arabian Journal for ence &Engineering,2011,36(7):1253-1267. [95] FENG Q,CAI Y F,KAZMAN R,et al.Active Hotspot:An Issue-Oriented Model to Monitor Software Evolution and Degradation[C]//IEEE/ACM International Conference on Automated Software Engineering (ASE 19).New York:IEEE,2019:986-997. [96] CAI Y,XIAO L,KAZMAN R,et al.Design Rule Spaces:A New Model for Representing and Analyzing Software Architecture[J].IEEE Transactions on Software Engineering,2019,45(7):657-682. |
[1] | 米庆, 郭黎敏, 陈军成. 基于多维度特征和混合神经网络的代码可读性评估方法 Code Readability Assessment Method Based on Multidimensional Features and Hybrid Neural Networks 计算机科学, 2021, 48(12): 94-99. https://doi.org/10.11896/jsjkx.200800193 |
[2] | 宗鹏洋, 王轶辰. 基于神经网络的软件质量评价综述 Software Quality Evaluation Based on Neural Network:A Systematic Literature Review 计算机科学, 2019, 46(11A): 507-516. |
[3] | 岳川, 彭小红. 带有区间信息的软件质量评价模型 Evaluation Model of Software Quality with Interval Data 计算机科学, 2019, 46(10): 209-214. https://doi.org/10.11896/jsjkx.180801554 |
[4] | 刘阳,刘秋荣,刘辉. 函数抽取重构的自动检测方法 Automated Detection of Extract Method Refactorings 计算机科学, 2015, 42(12): 105-107. |
[5] | 张杨,张冬雯,仇晶. 面向Java锁机制的字节码自动重构框架 Automated Refactoring Framework for Java Locks 计算机科学, 2015, 42(11): 84-89. https://doi.org/10.11896/j.issn.1002-137X.2015.11.017 |
[6] | 刘锦行,夏红霞. 一种利用UML的软件需求阶段风险评估方法 New Methods of Software Requirements Risk Assessment Using UML 计算机科学, 2014, 41(6): 131-135. https://doi.org/10.11896/j.issn.1002-137X.2014.06.026 |
[7] | 庞红彪,李之博,高小雅. 远程多管火箭炮火控系统的软件安全性测试分析 Software Safety Test Analysis for Fire Control System of Remote Multi-barrel Rocket 计算机科学, 2013, 40(Z6): 361-364. |
[8] | 张卫祥 刘文红 杜会森. 基于软件测试与知识发现的软件定量评估方法 Quantitative Assessing Method of Software Quality Evaluation Based on Software Testing and KDD 计算机科学, 2012, 39(Z11): 28-30. |
[9] | 马雪英 姚砺 叶澄清. 回归测试自动化工具研究 计算机科学, 2005, 32(3): 162-165. |
[10] | 鲍钦迪 胡昊 林向宇 吕建. 基于软件配置管理的度量研究 计算机科学, 2004, 31(4): 159-162. |
[11] | 黄文伟 徐宝文. FORTRAN 2000与C++面向对象机制比较 计算机科学, 2004, 31(3): 176-178. |
[12] | 杨宇 张健. 程序静态分析技术与工具 计算机科学, 2004, 31(2): 171-174. |
[13] | 刘建宾 朱学军 李满玲 郭伟斌. 一种基于平均测距的重构定位方法 计算机科学, 2004, 31(11): 162-165. |
[14] | 赵昊翔 潘金贵. 基于EVMS的软件过程改进 计算机科学, 2004, 31(11): 154-157. |
[15] | 沈夏炯 白景华 刘宗田 向国全. 形式概念分析与软件过程改进 计算机科学, 2003, 30(7): 103-105. |
|