软件在演化过程中经常被修改,软件结构往往会偏离原有的设计方向,软件质量也会逐渐变差。不良设计造成的技术债务在后续开发过程中会带来许多困难和阻碍,需要及时重构,改善原有代码的不良设计。对常见的重构操作进行了简单介绍和分类。在两个开源项目上进行了经验研究,关注两个问题:(1)重构在开源项目中是否被广泛应用,其中是否存在面向设计的重构;(2)是否存在没有及时重构改善原有代码的不良设计,导致后续开发遇到不必要的困难的情况,并且后续是否进行了重构。初步证明了重构在开源项目中的广泛应用和重要性,以及面向设计的重构的重要作用。
Software is constantly changing and evolving,driven by the increment of requirements.Software often degrades from the original design,the quality of codes also becomes poor.Developers will meet more barriers and difficulties in the future development when there are some technical debts in the original design.It is necessary to improve the quality of codes by refactorings.This paper introduces some common types of refactorings under the review of related literature,and introduces a simple case to verify the importance of the design-oriented refactorings.This paper aims to answer two questions:(1)whether there are applied refactorings in the open source project and whether there are design-oriented refactorings among them;(2)whether there exists some situation that the structure with a bad design causes difficulties in the fellow-up development and whether the developers apply some refactorings to it later.This paper proves the wide use and importance of refactorings in open source projects,particularly the importance of the design-oriented refactorings.