首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 812 毫秒
1.
基于源代码静态分析的C++0x泛型概念抽取   总被引:1,自引:0,他引:1  
使用泛型概念对领域知识进行抽象是泛型程序设计方法的基础.在新的C++0x标准中泛型概念将成为一个新的语言设施,这将为设计可复用、可扩展的泛型软件提供坚实的基础.为了更好地利用C++0x的新特性,有必要识别C++遗产代码中的泛型概念,并通过重构得到符合C++0x标准的代码.文中提出了一种基于代码静态分析的泛型概念自动识别方法,通过对泛型程序中类型参数的使用分析,从遗产代码中提取有效表达式约束和关联类型约束,进而推导出泛型概念.将该方法应用于C++标准模板库STL,可以识别出STL算法中绝大部分潜在的泛型概念,表明该方法有助于识别遗产代码中的泛型概念.  相似文献   

2.
现今面向对象已经成为软件业内的主流技术,然而它存在很多的弱点,使得它的通用性和抽象程度受到很大限制。设计模式作为面向对象领域内的高级软件复用技术,同样摆脱不了相同的困扰。泛型编程是面向对象的进一步发展,从更高的角度对世界进行抽象,为面向对象的不足之处提供了解决之道。将设计模式泛化带来更大规模的代码复用,使得设计模式的实现得以自动化,从而使开发人员能以面向设计的方式让使用者自行装配所需机能,产生能表达原始设计意图的代码,实现设计与编码之间的无缝过渡。  相似文献   

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

4.
基于设计模式的Raid Cache软件重构   总被引:1,自引:0,他引:1  
介绍了设计模式思想对提高嵌入式软件开发的稳定性、应变性和可维护性等方面的积极作用,在此基础上运用设计模式的面向接口编程原则、组合原则,以及策略模式、类厂模式等方法对嵌入式RAID磁盘阵列系统中传统的Cache模块代码进行重构。  相似文献   

5.
主要利用Java泛型编程将泛型机制与设计模式有机地结合并加以优化和实现,提出一种基于Java泛型类型(generic type)的类型转换方案,在工厂设计模式或其他应用中可有效摆脱类型强制转换或向下类型转换的过程中极容易发生错误的情况.并针对Spring中强制类型转换工厂进行改进,在利用工厂获得某个类的实例时不需要硬编码的方式强制转换实例的类型.该改进提高了软件体系结构的可扩展性,为程序设计者提供了方便.最后,通过实际编程验证了该方案的有效性以及在类型转换中的优越性.  相似文献   

6.
针对信息化软件开发、使用和维护过程中需求不断变化,扩展系统功能导致原有设计构架混乱,以及维护过程中的代码遗留问题,提出了一种采用基于插件体系结构的"主题-服务-插件"模型对系统实行软件重构的应用方案,在不改变系统原有功能的前提下,采用适配器设计模式统一系统模块接口,并运用观察者设计模式的通信模型实现系统模块之间的正常交互,消除系统模块之间的深度耦合,改善系统构架.最后运用该方案对通用车辆维修管理系统实施重构,实践结果表明,重构后的通用车辆维修管理系统更具灵活性、可扩展性,更好地适应用户的需求变化,方便测试维护,节约了维护成本.  相似文献   

7.
介绍了面向对象设计和设计模式,并以虚拟教室系统中的共享白板为基础讨论了面向对象软件重构过程中的一些问题.将设计模式和重构贯穿于面向对象的软件开发和演化过程可以得到更加灵活的、可复用的软件。  相似文献   

8.
基于设计模式的重构技术   总被引:2,自引:0,他引:2  
设计模式是编程过程中的设计经验,在应用程序的实现过程中可以利用设计模式,用重构的观念来对待设计模式的实现。采用测试优先的单元测试技术,可以保证重构的安全。介绍了这方面的知识,并举例说明了这种方法的可行性和有效性。  相似文献   

9.
基于组件的仿真系统设计和实现方法极大地提高了系统的可重用性和可扩展性.在仿真组件的构建中正交关注点分离成为系统设计的难点.首先提出了仿真组件正交关注点的概念,深入分析了正交关注点分离的原理,在此基础上,总结了在仿真组件程序设计过程中通常采用的方法,并基于设计模式和泛型编程给出了两种行之有效的方法.在其中详细对比两种方法侧重点的不同,以及聚合度、耦合度方面的考虑,为构造通用性好、组件可重用性好、易于理解、便于维护的基于组件的仿真系统提供了良好的解决方案.还介绍了正交关注点分离的新兴技术——AOP及其在仿真应用中的前景.  相似文献   

10.
陈林  徐宝文  钱巨  周天琳  周毓明 《软件学报》2009,20(10):2617-2627
重构泛型实例有利于提高软件的复用性和类型安全,但现有重构方法的时间复杂度较高,不适用于即时持续的重构.分析了变量类型传播分析方法在重构中的不足,提出了一种改进的泛型变量类型传播分析方法.该方法通过引入一种可以描述复杂参数化类型关系的泛型类型传播图,以复制节点的方式实现泛型变量属性敏感的类型分析,并通过解决别名问题来提高分析的精度.实例研究表明,可以在与程序规模呈近似线性增长的时间复杂度内实施重构,取得了较满意的效果.  相似文献   

11.
Refactoring consists in restructuring an object-oriented program without changing its behaviour. In this paper, we present refactorings as transformation rules for programs written in a refinement language inspired on Java that allows reasoning about object-oriented programs and specifications. A set of programming laws is available for the imperative constructs of this language as well as for its object-oriented features; soundness of the laws is proved against a weakest precondition semantics. The proof that the refactoring rules preserve behaviour (semantics) is accomplished by the application of these programming laws and data simulation. As illustration of our approach to refactoring, we use our rules to restructure a program to be in accordance with a design pattern.  相似文献   

12.
In the current trend, Extreme Programing methodology is widely adopted by small and medium-sized projects for dealing with rapidly or indefinite changing requirements. Test-first strategy and code refactoring are the important practices of Extreme Programing for rapid development and quality support. The test-first strategy emphasizes that test cases are designed before system implementation to keep the correctness of artifacts during software development; whereas refactoring is the removal of “bad smell” code for improving quality without changing its semantics. However, the test-first strategy may conflict with code refactoring in the sense that the original test cases may be broken or inefficient for testing programs, which are revised by code refactoring. In general, the developers revise the test cases manually since it is not complicated. However, when the developers perform a pattern-based refactoring to improve the quality, the effort of revising the test cases is much more than that in simple code refactoring. In our observation, a pattern-based refactoring is composed of many simple and atomic code refactorings. If we have the composition relationship and the mapping rules between code refactoring and test case refactoring, we may infer a test case revision guideline in pattern-based refactoring. Based on this idea, in this research, we propose a four-phase approach to guide the construction of the test case refactoring for design patterns. We also introduce our approach by using some well-known design patterns and evaluate its feasibility by means of test coverage.  相似文献   

13.
Extreme programming (XP) is an agile software process that promotes early and quick production of working code. In this paper, we investigated the relationship among three XP engineering activities: new design, refactoring, and error fix. We found that the more the new design performed to the system the less refactoring and error fix were performed. However, the refactoring and error fix efforts did not seem to be related. We also found that the error fix effort is related to number of days spent on each story, while new design is not. The relationship between the refactoring effort and number of days spent on each story was not conclusive.  相似文献   

14.
Thomas  D. 《Software, IEEE》2005,22(3):14-16
Agile development focuses on accommodating program evolution. It's important in design to consider those points of the system that likely undergoes substantial change. At such points, it's often appropriate to apply agile-programming techniques. Agile programming is design for change, without refactoring and rebuilding. Its objective is to design programs that are receptive to, indeed expect, change. Ideally, agile programming lets changes be applied in a simple, localized way to avoid or substantially reduce major refactorings, retesting, and system builds.  相似文献   

15.
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.  相似文献   

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

17.
以学院评教系统业务变化为背景,按照面向对象的基本原理,对网上评教系统进行了分析和重构。利用UML建立重构模型,并结合.NET的配置文件和反射机制实现了评教系统面向接口编程插件式框架的设计,为学院评教系统提供了极大的扩展空间。  相似文献   

18.
多约束排序问题是生产调度中常遇到的问题,传统的优化模型及方法在适应约束改变等方面存在诸多不足。鉴于此,将多约束排序问题定义为约束满足问题,系统设计时将模型定义与求解算法分离,利用约束规划平台的基本约束构建特定领域的抽象约束库,形成可重构的多约束排序问题通用求解框架。应用时,根据问题需求不同可利用抽象约束库快速重构优化模型,针对重构的优化模型配置相应的求解算法即可实现问题求解。应用结果表明,提出的方法通用性强,可满足实际应用的要求。  相似文献   

19.
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.  相似文献   

20.
ContextThe automated identification of code fragments characterized by common design flaws (or “code smells”) that can be handled through refactoring, fosters refactoring activities, especially in large code bases where multiple developers are engaged without a detailed view on the whole system. Automated refactoring to design patterns enables significant contributions to design quality even from developers with little experience on the use of the required patterns.ObjectiveThis work targets the automated identification of refactoring opportunities to the Strategy design pattern and the elimination through polymorphism of respective “code smells” that are related to extensive use of complex conditional statements.MethodAn algorithm is introduced for the automated identification of refactoring opportunities to the Strategy design pattern. Suggested refactorings comprise conditional statements that are characterized by analogies to the Strategy design pattern, in terms of the purpose and selection mode of strategies. Moreover, this work specifies the procedure for refactoring to Strategy the identified conditional statements. For special cases of these statements, a technique is proposed for total replacement of conditional logic with method calls of appropriate concrete Strategy instances. The identification algorithm and the refactoring procedure are implemented and integrated in the JDeodorant Eclipse plug-in. The method is evaluated on a set of Java projects, in terms of quality of the suggested refactorings and run-time efficiency. The relevance of the identified refactoring opportunities is verified by expert software engineers.ResultsThe identification algorithm recalled, from the projects used during evaluation, many of the refactoring candidates that were identified by the expert software engineers. Its execution time on projects of varying size confirmed the run-time efficiency of this method.ConclusionThe proposed method for automated refactoring to Strategy contributes to simplification of conditional statements. Moreover, it enhances system extensibility through the Strategy design pattern.  相似文献   

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

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