用户名: 密码: 验证码:
软件重构
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
软件在其生命周期内,变化不可避免。变化来自多个方面,用户需求变化、纠正错误、软件应用环境变化等等。运用重构技术可以改善软件内部结构,防止代码的腐败,延长软件的维护成本和使用寿命。重构理论也随着大规模软件应用的需求而飞速发展,并形成了完善的理论体系,目前重构方法学也是软件工程领域的一个研究热点。
     本文对软件重构的理论进行了比较系统的研究,结合秦山核电项目的重构实践介绍了软件重构的基本概念,方法,及重构中的测试策略。在基本重构活动中,详细阐述了基于“代码坏味”的重构原则,实施办法,及重构案例分析。并通过软件质量保证审计标准比较了重构前及重构后系统的代码优化指标。在基于设计模式的重构部分,阐述了运用模式重构的一般方法,设计并深入分析了“显示与领域分离”,“动态共享机制”,“友好人机交互”,及“满足未来变化”等四种模式重构方法,给出了重构案例。最后通过以上模式重构的实践活动,总结了模式重构的基本思路和应用流程。经过重构前后系统的设计比较,重构取得明显的效果:改善了既有代码的质量,解决了相应模块难于维护难于扩展的问题。
     本文阐述的基本重构实践活动,及归纳的模式重构方法具有一定的普遍意义,对于软件设计及软件重构的实施具有一定参考价值。
Software changes inevitably in its life-cycle. It changes for some reasons, for example, to erase errors, to adjust the changes of the requirements and the contexts and so on. The changes of software bring the problems of software entropy. Refactoring or restructuring can improve the internal structure without altering the external behavior and prevent codes from decaying. To some extend, it can counter the problem of software entropy.
     This paper provides a systematic research in the field of the software refactoring including its theory, method and strategies. This paper also introduces the basic Refactoring Tools used in the refactoring procedure.
     Though the research and analysis on the QinShan Nuclear System, the paper introduces the Software Refactoring driven by the Software Quality Audits methods, the Software Refactoring driven by the“bad code smells”. Furthermore, the paper introduces the advanced refactoring based on the Design Pattern, and explains the technique to separate the user interface codes and the high performance share strategies. In addition, the paper concludes the process of refactoring based on the pattern design.
     By comparing the old system and the refactoring system, the refactoring got obvious effects: improving the quality of code and solute the problem of difficulty to maintain and extend the system.
引文
[1] Bertrand Meyer. Software Construction. Addison-Wesley, 1997:63-70
    [2] 张海潘 软件工程导论 北京:清华大学出版社 1999:166-167
    [3] Frederick P. Brooks, Jr. The Mythical Man-Month: Essays on software Engineering. Addison-Wesley, 1975: 25-30
    [4] Robert S. Arnold. An introduction to software restructuring. Tutorial on software Restructuring(Robert S. Arnold, ed.), 1986:1-4
    [5] Roger S. Pressman. 软件工程——实践者的研究方法 黄柏索,梅宏 北京:机械工业出版社 2001: 535-537
    [6]Peter Freeman. Reusable software Engineering: Concepts and Research Directions. In Tutorial: Software Reusability, ed.1987:10-23
    [7]W.H ursch, L.Seiter. Automating the Evolution of Object-Oriented systems. In Proceeding of ISOTAS’96. Japan. March 2000:2-21
    [8]Martin Fowler Kent Beck, John Brant, William Opdyke, Don Roberts. Refactoring-Improving the Design of Existing Code. 北京:中国电力出版社,2003 年 8 月
    [9]Robert Francd, Sudipto Ghosh, Eunjee Song, and Dae-Kyoo Kim A Metamodeling Approach to Pattern-Based Model Refactoring, 2003 IEEE Computer Society
    [10]Martin Fowler, Separating User Interface Code, March/April 2001
    [11] Foote B,Yoder J W.Big Ball of Mud.In:Fourth Conference on Patterns Languages of Programs(PLoP'97),Monticello,Illinois,1997
    [12] Beck K.Extreme Programming Explained.Addison-Wesley Publishing Company,1999
    [13]Software entropy.Online at:http:// www.webopedia.con/TERM/S/software-entropy.html
    [14] E.J. Chikofsky and J.H. Cross,"Reverse Engineering and Design Recovery: A Taxonomy," IEEE Software, vol.7, no.1, pp13-17,1990.
    [15] E.Gamma, R.Helm, R.Johnsonand J.Vlissides. 《设计模式——可复用面向对象的软件基础》。李英军,马晓星,蔡敏,刘建中译,吕建审校。机械工业出版社,2000
    [16]William F.Opdyke, Ph.D. diss, Refactoring Object-OrientedFrameworks. University of Illinois at Urbana-Champaign, 1992.
    [17]冯铁,李文锦,张家晨,从源码中抽取设计模式技术研究综述 2005 年,计算机应用
    [18]马志强,司国东,李柏林,将领域与显示分离重构方法的应用研究,2005年第五期,信息技术
    [19]付友涛,许林英,软件工程新方法--软件重构,《微型计算机应用》2003年第 10 期
    [20]陈生庆,张立臣,陈广明,面向方面软件重构等价性形式化证明方法,计算机科学 2006 Vol.33 No.7
    [21]官晓冲 基于模板的重构,《微机发展》2004 年 4 月
    [22]J.Brant and Don Roberts. Refactoring Browser Tool, http://st-www.cs.uiuc.edu/~brant/RefactoringBrowser
    [23] E Gamma,R Helm,R Johnson,et al. Design Patterns:Elements of Reusable Object-Oriented Software[M]. Addison Wesley Publishing Company,Reading,MA,1995.
    [24]H Albin-Amiot,Y-G Gueheneuc. Meta-modeling Design Patterns: Application to Pattern Detection and Code Synthesis[A]. Bedir Tekinerdogan. Proc. of ECOOP Workshop on Automating Object-Oriented Software Development Methods[EB/OL]. http ://www.yanngael.gueheneuc.net/Work/Publications/Documents/ECOOP01AOOSDM. doc. pdf,2001-06.
    [25]K Brown. Design Reverse-engineering and Automated Design Pattern Detection in Smalltalk[D]. Master Thesis,University of Illinois at Urbana Champaign,1996.
    [26]J Niere,J Wadsack,L wendehals. Handling Large Search Space in Pattern-based Reverse Engineering[C]. Proc. of the 11th IEEE International Workshop on Program Comprehension, 2003.274.
    [27] J M Smith,D Stotts. SPQR:Flexible Automated Design Pattern Extraction from Source Code[R]. Technical Report TR03-016 ,Department of Computer Science University of North Carolina at Chapel Hill,2003.
    [28] Design Patterns Explained(2nd edition) 北京:人民邮电出版社,2006 年 10 月.
    [29] James W. Cooper. C# Design Patterns: A Tutorial 北京,电子工业出版社,2003 年 8 月.
    [30] Joshua Kerievsky. Refactoring To Patterns 北京,人民邮电出版社,2006 年 12 月.
    [31] Robert C. Martin Agile Software Development Principles, Patterns, and Practices. 北京,清华大学出版社,2003 年 9 月
    [32] Ken. Auer “Reusability through Self-Encapsulation.” In Pattern Languages of Program Design 1, Coplien J.O. Schmidt.D.C.Reading, Mass.:Addison-Wesley,1995.
    [33] Ken.Beck “Make it Run, Make it Right: Design Through Refactoring.” The Smalltalk Report, 6:(1997b):19-24.
    [34] Bertrand. Meyer, Object Oriented Software Construction. 2 ed. Upper Saddle River, N.J.:Prentice Hall, 1997.
    [35] Alexander, Christopher, A Pattern Language. New York: Oxford University Press, 1977.
    [36] Evans, Eric, Domain-Driven Design. Boston, MA: Addison-Wesley, 1995
    [37] Fowler, Martin. UML Distilled, 3rd ed. Boston, MA: Addison-Wesley, 2003.
    [38] Erich Gamma Richard Helm Ralph Johnson John Vlissides Design Patterns Elements of Reusable Object-Oriented Software Addison Wesley, 1998

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700