首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 93 毫秒
1.
重构是软件系统不断演化的关键之一,也是一项复杂而又困难的活动.传统的定位重构代码方法依赖开发者的观察和主观意识,耗时耗力,尤其在重构代码较多时.因此,提出了一套自动化定位重构的方法.该方法利用基于面向对象软件度量指标获取代码特征信息,使用相关性检验查验特征信息数据,应用主成分分析压缩和解释特征信息,应用聚类分析分类相似代码段,迅速准确定位重构.一个简单的实例表明该方法是简单有效的,并且优于传统方法.  相似文献   

2.
为提高重构效率,提出一种通过代码行变更指数来对异味类进行排序的方法.此前对于代码异味的研究主要关注静态代码行度量指标,但是在整个项目开发过程中代码行数是动态变化的,且变化规模越大的类出现异味的概率越大.通过对整个项目开发过程中代码行动态变化过程进行分析,提出代码行变更指数对异味类变化规模进行排序,使其重构主要关注那些变化较大的异味类,减少重构成本.对比实验结果表明,按照该方法对异味类进行重构,可以减少异味剩余率,提高重构效率.  相似文献   

3.
集对分析具有概念明确、计算简便和信息全面的优点,针对软件重构过程中,传统定位重构代码的方法仅仅依靠开发者的观察和主观意识进行判断的缺点,在集对分析同一度理论的基础上,借助软件度量的相关指标,建立了软件重构方案优选的集对分析模型,为软件重构方案优选提供了一种解决方法。运用变异系数法确定指标权重,提高了方案评价的可信度。实验结果证明,集对分析模型能够正确地定位需要重构的软件代码,并能够给出具体的重构顺序。  相似文献   

4.
张献  贲可荣  曾杰 《软件学报》2021,32(7):2219-2241
软件缺陷预测是软件质量保障领域的一个活跃话题,它可以帮助开发人员发现潜在的缺陷并更好地利用资源.如何为预测系统设计更具判别力的度量元,并兼顾性能与可解释性,一直是人们致力于的研究方向.针对这一挑战,提出了一种基于代码自然性特征的缺陷预测方法——CNDePor.该方法通过正逆双向度量代码和利用质量信息对样本加权的方式改进语言模型,提高了模型所得交叉熵(CE)类度量元的缺陷判别力.针对粗粒度缺陷预测存在难以聚焦缺陷区域、代码审查成本高的不足,研究了一种新的细粒度缺陷预测问题——面向语句的切片级缺陷预测.在此问题上,设计了4种度量元,并在两类安全缺陷数据集上验证了度量元和CNDePor方法的有效性.实验结果表明:CE类度量元具有可学习性,它们蕴涵了语言模型从语料库中学习到的相关知识;改进的CE类度量元的判别力明显优于原始度量元和传统规模度量元;CNDePor方法较传统缺陷预测方法和已有的基于代码自然性的方法有显著优势,较先进的基于深度学习的方法具有可比性性能和更强的可解释性.  相似文献   

5.
目前锥束CT的三维重构主要采用面绘制,其方法有两类,即体素级重构和切片级重构。在对比两类方法的基础上,提出了一种新的二维切片轮廓重构与三维表面重构相结合的切片级重构方法,然后以标准MC算法和该算法分别对两个实例进行重构并比较。结果表明,该算法更适合工业产品的三维表面重构。  相似文献   

6.
卜依凡  刘辉  李光杰 《软件学报》2019,30(5):1359-1374
上帝类是指某个承担了本应由多个类分别承担的多个职责的类.上帝类违背了分而治之的基本思想以及单一职责的设计原则,严重影响软件的可维护性和可理解性.但上帝类又是一种比较常见的代码坏味.因此,针对上帝类的检测与重构一直是代码重构领域的研究热点之一.为此,提出了一种基于深度神经网络的上帝类检测方法.该方法不仅利用了常见的软件度量,而且充分利用了代码中的文本信息,意图通过挖掘文本语义揭示每个类所承担的主要角色.此外,为了解决有监督深度学习所需的海量标签数据,提出了一种基于开源代码构造标签数据的方法.最后,基于开源数据集对所提出的方法进行了实验验证.实验结果表明,这些方法优于现有的上帝类检测方法,尤其是在查全率上有大幅度的提升(提高了35.58%).  相似文献   

7.
随着软件的演化,软件规模和复杂性的上升往往会造成代码设计质量的退化,进而导致代码可维护性下降。已有大量软件度量指标用于量化代码设计质量,但是由于数量众多,不同指标体系度量结果可比性较差,使得开发人员难以找到存在设计质量问题的模块。系统调研并整理归类了现有的规模、耦合、内聚、封装、继承和多态等6方面软件度量指标。结合度量指标关系以及实验分析,从每个方面的指标集中发现了与代码设计质量关联度最高的6个指标,从而提出一种面向代码设计质量监控的软件度量指标集。实验表明,该指标集可以有效挑选出存在代码设计质量问题的类,可作为开发人员监控和定位代码设计问题的重点关注指标。  相似文献   

8.
目前许多研究人员对自动化软件重构进行了探索并开发了一系列重构工具,旨在帮助程序员更高效地完成软件重构任务、提升代码质量。然而,现有的软件重构工具多侧重于局部的设计或编码问题,而非设计层面的问题。另一方面,基于搜索的重构方法往往将改进某一项代码度量指标作为重构目标,而非面向软件的层次化设计。针对这种情况,提出一种新的基于搜索的软件自动化重构方法,该方法使用了基于设计结构矩阵(DSM)的软件模块层次化度量方法,能够自动生成可以得到最优软件模块化设计的重构建议。在此基础上,实现了自动化重构工具DSMRefactoring,并将DSMRefactoring应用于开源系统进行案例研究,初步验证了方法和工具的有效性。  相似文献   

9.
辛良  姜淑娟 《计算机工程》2010,36(14):54-55
将程序切片技术应用于程序错误定位可以大量减少需要测试的语句数。提出一种基于关键谓词的程序错误定位方法,从程序中找出能影响输出结果的关键谓词,对该谓词和错误输出语句进行数据切片,并引入代码优先技术。该方法考虑了数据依赖和控制依赖,能实现准确快速的错误定位。  相似文献   

10.
在软件开发的过程中,开发人员通过复制粘贴式的开发方式或者模块化的开发方式来完成需求是十分常见的,这两种开发方式可以提高开发效率,但同时会导致软件系统中出现大量的相同代码或者相似代码,大量的相似代码会给软件维护等方面带来很大的困难,这也是最常见的重构对象。源代码相似性度量是指利用一定的检测方法分析程序源代码间的相似程度。该技术被应用于代码抄袭检测、代码克隆检测、软件知识产权保护、代码复用等多个领域。为了提高代码相似性度量的准确性,提出了一种基于多特征值的源代码相似性检测技术。构建了源代码注释、型构、代码文本语句与结构中特征提取的方法,并给出了源代码相似度检测的度量模型。通过与权威的代码相似检测系统Moss进行对比实验,结果表明该方法可以更准确地检测出相似代码。  相似文献   

11.
首先设计并实现一个基于摄像头的阅卷系统,该系统由试卷获取、灰度化、二值化、畸变变换、倾斜校正、图像定位和识别等图像处理流程组成。然后以此为依据,通过对重构技术及设计模式原则和方法的系统研究,对该系统框架进行优化和重构。本文充分参照现有的设计模式,通过重构技术,改善现有代码的质量,增加系统的可维护性和可复用性。  相似文献   

12.
软件体系结构中的横切关注点增加了软件体系结构的复杂性,从而加剧了体系结构演化与维护的困难.这种设计问题可以通过体系结构层面的重构来进行改善.在已有的横切特征分析方法基础上,提出了一种面向横切特征分析的体系结构自动重构方法.该方法首先基于特征与构件之间的追踪关系分析横切特征,然后将与横切特征有直接追踪关系的构件从初始体系结构中提取出来,实现方面构件,完成体系结构重构.在面向方面体系结构描述语言AO-ADL基础上开发了相应的体系结构重构工具,并针对一个业务系统进行了体系结构重构实验.实验结果表明,该方法能有效地实现体系结构横切特征的自动化重构.  相似文献   

13.
在现代软件开发和维护中,重构是提高软件可维护性和软件质量的常用手段.而大量重构模式掺杂在日常的bug修复、功能增加等代码变更中,使得变更理解变得非常复杂.识别重构模式可以将重构与其它类型的代码变更隔离,利于变更理解.目前在识别重构模式的相关研究中,并没有结合变更类型和相似性比较的识别重构模式的方法及工具.为此,提出了一种基于细粒度变更类型和文本相似性比较识别重构模式的方法.将该方法应用于抽取类重构模式,并在4个开源项目中进行了实验,其平均准确率在82.6%左右.  相似文献   

14.
冲突是研究模型重构中的一个重要问题,多数研究将该问题的重点放在冲突检测上,通过对已知冲突的分析,找出冲突消解的手工实现方式.为实现模型重构的自动过程而寻找自动消解冲突的方法是主要研究内容.根据冲突发生的条件将冲突分为3种类型:同一规则的并行使用产生的冲突、对称冲突、非对称冲突.该方法建立在手工分析这3类重构冲突消解的基础上,将重构规则预设为一个规则矩阵,对图转换系统中出现的重构规则进行扫描.扫描结果对照规则矩阵,判断冲突是同一规则还是不同规则的并行使用所产生;分别对这两种情况下的冲突所操作的对象进行分析,根据已有手工消解方法有针对性地进行消解操作.这一算法可以初步实现并行执行的3类冲突的自动消解.  相似文献   

15.
对当前软件重构领域中的研究作了概括性介绍。对作为重构的主导思想和系统体系结构的总体转换方向的设计模式进行介绍,针对原有的Visitor设计模式在运行中操作调用频繁时资源消耗过大和运行效率降低的不足,在原模式基础上进行改良和优化,生成一种新的设计模式Visitor*,并对其具体分析,通过操作函数的上移和accept方法的重定义,实现了操作定义由Element层到Visitor层的等价转化,大大节省资源和提高运行效率。最后运用Visitor^*实现了一个面向对象设计过程中的重构,并结合一些重要概念对其进行具体分析。  相似文献   

16.
随着软件系统的演化,其模块化结构会逐渐退化。软件重构是调整系统结构的重要手段,但哪些模块最需要重构却难以预测。提出了一种基于程序聚类技术的模块重构风险分析方法,该方法通过对目标系统进行结构聚类和语义聚类获得其参考模块化结构,然后比较现实模块化结构与参考模块化结构之间的差异,对程序模块的设计质量进行评价,识别出系统中重构风险较高的模块。实验以三个开源软件的演化历史作为研究对象,与传统的模块化度量方法进行了比较,结果表明采用所提方法获得的预测结果与实际重构活动有较好的吻合度,从而验证了该方法的有效性。  相似文献   

17.
ContextApplication of a refactoring operation creates a new set of dependency in the revised design as well as a new set of further refactoring candidates. In the studies of stepwise refactoring recommendation approaches, applying one refactoring at a time has been used, but is inefficient because the identification of the best candidate in each iteration of refactoring identification process is computation-intensive. Therefore, it is desirable to accurately identify multiple and independent candidates to enhance efficiency of refactoring process.ObjectiveWe propose an automated approach to identify multiple refactorings that can be applied simultaneously to maximize the maintainability improvement of software. Our approach can attain the same degree of maintainability enhancement as the method of the refactoring identification of the single best one, but in fewer iterations (lower computation cost).MethodThe concept of maximal independent set (MIS) enables us to identify multiple refactoring operations that can be applied simultaneously. Each MIS contains a group of refactoring candidates that neither affect (i.e., enable or disable) nor influence maintainability on each other. Refactoring effect delta table quantifies the degree of maintainability improvement each elementary candidate. For each iteration of the refactoring identification process, multiple refactorings that best improve maintainability are selected among sets of refactoring candidates (MISs).ResultsWe demonstrate the effectiveness and efficiency of the proposed approach by simulating the refactoring operations on several large-scale open source projects such as jEdit, Columba, and JGit. The results show that our proposed approach can improve maintainability by the same degree or to a better extent than the competing method, choosing one refactoring candidate at a time, in a significantly smaller number of iterations. Thus, applying multiple refactorings at a time is both effective and efficient.ConclusionOur proposed approach helps improve the maintainability as well as the productivity of refactoring identification.  相似文献   

18.
ContextObject-oriented software undergoes continuous changes—changes often made without consideration of the software’s overall structure and design rationale. Hence, over time, the design quality of the software degrades causing software aging or software decay. Refactoring offers a means of restructuring software design to improve maintainability. In practice, efforts to invest in refactoring are restricted; therefore, the problem calls for a method for identifying cost-effective refactorings that efficiently improve maintainability. Cost-effectiveness of applied refactorings can be explained as maintainability improvement over invested refactoring effort (cost). For the system, the more cost-effective refactorings are applied, the greater maintainability would be improved. There have been several studies of supporting the arguments that changes are more prone to occur in the pieces of codes more frequently utilized by users; hence, applying refactorings in these parts would fast improve maintainability of software. For this reason, dynamic information is needed for identifying the entities involved in given scenarios/functions of a system, and within these entities, refactoring candidates need to be extracted.ObjectiveThis paper provides an automated approach to identifying cost-effective refactorings using dynamic information in object-oriented software.MethodTo perform cost-effective refactoring, refactoring candidates are extracted in a way that reduces dependencies; these are referred to as the dynamic information. The dynamic profiling technique is used to obtain the dependencies of entities based on dynamic method calls. Based on those dynamic dependencies, refactoring-candidate extraction rules are defined, and a maintainability evaluation function is established. Then, refactoring candidates are extracted and assessed using the defined rules and the evaluation function, respectively. The best refactoring (i.e., that which most improves maintainability) is selected from among refactoring candidates, then refactoring candidate extraction and assessment are re-performed to select the next refactoring, and the refactoring identification process is iterated until no more refactoring candidates for improving maintainability are found.ResultsWe evaluate our proposed approach in three open-source projects. The first results show that dynamic information is helpful in identifying cost-effective refactorings that fast improve maintainability; and, considering dynamic information in addition to static information provides even more opportunities to identify cost-effective refactorings. The second results show that dynamic information is helpful in extracting refactoring candidates in the classes where real changes had occurred; in addition, the results also offer the promising support for the contention that using dynamic information helps to extracting refactoring candidates from highly-ranked frequently changed classes.ConclusionOur proposed approach helps to identify cost-effective refactorings and supports an automated refactoring identification process.  相似文献   

19.
In this paper we propose a systematic strategy for migrating crosscutting concerns in existing object-oriented systems to aspect-oriented programming solutions. The proposed strategy consists of four steps: mining, exploration, documentation and refactoring of crosscutting concerns. We discuss in detail a new approach to refactoring to aspect-oriented programming that is fully integrated with our strategy, and apply the whole strategy to an object-oriented system, namely the JHotDraw framework. Moreover, we present a method to semi-automatically perform the aspect-introducing refactorings based on identified crosscutting concern sorts which is supported by a prototype tool called sair. We perform an exploratory case study in which we apply this tool on the same object-oriented system and compare its results with the results of manual migration in order to assess the feasibility of automated aspect refactoring. Both the refactoring tool sair and the results of the manual migration are made available as open-source, the latter providing the largest aspect-introducing refactoring available to date. We report on our experiences with conducting both case studies and reflect on the success and challenges of the migration process. M. Marin is a guest at Delft University of Technology.  相似文献   

20.
面向RIA的系统重构模型   总被引:2,自引:0,他引:2       下载免费PDF全文
孙勇  林菲 《计算机工程》2009,35(24):282-284
利用软件工程中的重构技术,提出一种基于抽象数据视图的系统转换模型。采用抽象数据状态图与经典重构策略相结合的方式对系统进行重构,通过映射方法平滑地将Web应用程序转换为富互联网应用(RIA)程序。实验结果表明,该模型能够提升用户界面的质量与易用性,降低设计与开发过程中的工作量。  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号