共查询到20条相似文献,搜索用时 15 毫秒
1.
ContextNull-checking conditionals are a straightforward solution against null dereferences. However, their frequent repetition is considered a sign of poor program design, since they introduce source code duplication and complexity that impacts code comprehension and maintenance. The Null Object design pattern enables the replacement of null-checking conditionals with polymorphic method invocations that are bound, at runtime, to either a real object or a Null Object. ObjectiveThis work proposes a novel method for automated refactoring to Null Object that eliminates null-checking conditionals associated with optional class fields, i.e., fields that are not initialized in all class instantiations and, thus, their usage needs to be guarded in order to avoid null dereferences. MethodWe introduce an algorithm for automated discovery of refactoring opportunities to Null Object. Moreover, we specify the source code transformation procedure and an extensive set of refactoring preconditions for safely refactoring an optional field and its associated null-checking conditionals to the Null Object design pattern. The method is implemented as an Eclipse plug-in and is evaluated on a set of open source Java projects. ResultsSeveral refactoring candidates are discovered in the projects used in the evaluation and their refactoring lead to improvement of the cyclomatic complexity of the affected classes. The successful execution of the projects’ test suites, on their refactored versions, provides empirical evidence on the soundness of the proposed source code transformation. Runtime performance results highlight the potential for applying our method to a wide range of project sizes. ConclusionOur method automates the elimination of null-checking conditionals through refactoring to the Null Object design pattern. It contributes to improvement of the cyclomatic complexity of classes with optional fields. The runtime processing overhead of applying our method is limited and allows its integration to the programmer’s routine code analysis activities. 相似文献
2.
重构是在不改变代码外在行为的前提下,对代码做出修改,以改进程序内部结构的过程.设计模式是对被用来在特定场景下解决一般设计问题的类和相互通信的对象的描述.泛型编程专注于将型别抽象化,形成功能需求方面的一个精细集合,并利用这些需求来实现算法.以一个应用系统的数据采集子系统的系统重构为例,将设计模式应用于系统重构中设计阶段,将泛型技术应用于系统重构实现阶段;讨论设计模式技术和泛型技术的结合对系统重构的作用与意义. 相似文献
3.
对当前软件重构领域中的研究作了概括性介绍。对作为重构的主导思想和系统体系结构的总体转换方向的设计模式进行介绍,针对原有的Visitor设计模式在运行中操作调用频繁时资源消耗过大和运行效率降低的不足,在原模式基础上进行改良和优化,生成一种新的设计模式Visitor*,并对其具体分析,通过操作函数的上移和accept方法的重定义,实现了操作定义由Element层到Visitor层的等价转化,大大节省资源和提高运行效率。最后运用Visitor^*实现了一个面向对象设计过程中的重构,并结合一些重要概念对其进行具体分析。 相似文献
4.
重构是指在保持程序现有功能的前提下提高程序质量的一种技术。通过对Eclipse的自动重构框架LTK(Language ToolKit)的研究,介绍它的工作原理和各主要插件的功能。并举例说明利用Eclipse的自动重构框架创建新的重构的基本方法。 相似文献
5.
Design defects are symptoms of design decay, which can lead to several maintenance problems. To detect these defects, most of existing research is based on the definition of rules that represent a combination of software metrics. These rules are sometimes not enough to detect design defects since it is difficult to find the best threshold values; the rules do not take into consideration the programming context, and it is challenging to find the best combination of metrics. As an alternative, we propose in this paper to identify design defects using a genetic algorithm based on the similarity/distance between the system under study and a set of defect examples without the need to define detection rules. We tested our approach on four open-source systems to identify three potential design defects. The results of our experiments confirm the effectiveness of the proposed approach. 相似文献
7.
Design patterns capture development solutions to design problems in forms that make the designs more modular, modifiable, reusable, and understandable. This metamodeling approach to pattern-based refactoring of design models incorporates the precise specification of design patterns and transformation rules. 相似文献
8.
The efficient design of computation intensive multidimensional signal processing applications requires dealing with three kinds of constraints: those implied by the data dependencies, the non-functional requirements (real-time, power consumption) and resources availability of the execution platform. Modeling and Analysis of Real-time and Embedded systems (MARTE) UML profile through its repetitive structure modeling (RSM) package is well suited to model the inherent parallelism within these applications, a compact representation of parallel execution platforms and the distributive mapping of one on another. The execution of such a specification respects the whole set of constraints defined upon, while the quality of the scheduling is directly linked to the quality of the mapping of the multidimensional structures (data arrays or parallel loop nests) into time and space. We propose here a strategy to use a refactoring tool dedicated to this kind of application that allows to find good trade-offs in the usage of storage and computation resources and in parallelism (both task and data parallelism) exploitation. This strategy is illustrated on an industrial radar application. 相似文献
9.
In this paper, we hypothesize that the distorted traceability tracks of a software system can be systematically re-established through refactoring, a set of behavior-preserving transformations for keeping the system quality under control during evolution. To test our hypothesis, we conduct an experimental analysis using three requirements-to-code datasets from various application domains. Our objective is to assess the impact of various refactoring methods on the performance of automated tracing tools based on information retrieval. Results show that renaming inconsistently named code identifiers, using Rename Identifier refactoring, often leads to improvements in traceability. In contrast, removing code clones, using eXtract Method (XM) refactoring, is found to be detrimental. In addition, results show that moving misplaced code fragments, using Move Method refactoring, has no significant impact on trace link retrieval. We further evaluate Rename Identifier refactoring by comparing its performance with other strategies often used to overcome the vocabulary mismatch problem in software artifacts. In addition, we propose and evaluate various techniques to mitigate the negative impact of XM refactoring. An effective traceability sign analysis is also conducted to quantify the effect of these refactoring methods on the vocabulary structure of software systems. 相似文献
10.
To create successful interactive systems, user interface designers need to cooperate with developers and application domain experts in an interdisciplinary team. These groups, however, usually lack a common terminology to exchange ideas, opinions and values. This paper presents an approach that uses pattern languages to capture this knowledge in software development, human-computer interaction (HCI) and the application domain. A formal, domain-independent definition of design patterns allows for computer support without sacrificing readability, and pattern use is integrated into the usability engineering life cycle. As an example, experience from building an award-winning interactive music exhibit was turned into a pattern language, which was then used to inform follow-up projects and support HCI education.An earlier version of this paper appeared in the Proceedings of the DIS 2000 International Conference on Designing Interactive Systems (16–19 August 2000, New York) and appears by permission of the ACM Press. 相似文献
11.
Software security becomes a critically important issue for software development when more and more malicious attacks explore the security holes in software systems. To avoid security problems, a large software system design may reuse good security solutions by applying security patterns. Security patterns document expert solutions to common security problems and capture best practices on secure software design and development. Although each security pattern describes a good design guideline, the compositions of these security patterns may be inconsistent and encounter problems and flaws. Therefore, the compositions of security patterns may be even insecure. In this paper, we present an approach to automated verification of the compositions of security patterns by model checking. We formally define the behavioral aspect of security patterns in CCS through their sequence diagrams. We also prove the faithfulness of the transformation from a sequence diagram to its CCS representation. In this way, the properties of the security patterns can be checked by a model checker when they are composed. Composition errors and problems can be discovered early in the design stage. We also use two case studies to illustrate our approach and show its capability to detect composition errors. 相似文献
12.
Code smells are a popular mechanism to find structural design problems in software systems. Consequently, several tools have emerged to support the detection of code smells. However, the number of smells returned by current tools usually exceeds the amount of problems that the developer can deal with, particularly when the effort available for performing refactorings is limited. Moreover, not all the code smells are equally relevant to the goals of the system or its health. This article presents a semi-automated approach that helps developers focus on the most critical problems of the system. We have developed a tool that suggests a ranking of code smells, based on a combination of three criteria, namely: past component modifications, important modifiability scenarios for the system, and relevance of the kind of smell. These criteria are complementary and enable our approach to assess the smells from different perspectives. Our approach has been evaluated in two case-studies, and the results show that the suggested code smells are useful to developers. 相似文献
13.
Universal access should be a target for all public Web sites. However, it is very hard to achieve, and even Web applications that comply with accessibility standards may still lack usability for disabled users. This paper proposes refactoring as an essencial technique to incrementally improve the accessibility and usability of a Web interface. Some accessibility refactorings are described and classified by the problems that each refactoring addresses. The way mainstream Web sites struggle with accessibility is illustrated, and two evaluations of email clients are presented as empirical evidence of the significance of accessibility refactorings at a low implementation cost. 相似文献
14.
As more enterprises move to client-server environments, object technology is gaining favour as a means of migrating legacy applications. The object paradigm is well suited for modeling real world business processes and has the flexibility to integrate emerging technologies. However, the most difficult aspect of object-oriented applications development is not programming but technical design. This article explores a methodology that formalizes and automates object-based technical design in the domain of information management systems 相似文献
15.
Using cloud-based services can improve the performance, reliability, and scalability of a software application. However, transitioning an application to use cloud-based services is difficult, costly, and error-prone. The required re-engineering effort includes migrating to the cloud the functionality to be accessed as remote cloud-based services and re-targeting the client code accordingly. In addition, the client must be able to detect and handle the faults raised in the process of invoking the services. As a means of streamlining this transitioning, we developed a set of refactoring techniques—automated, IDE-assisted program transformations that eliminate the need to change programs by hand. In particular, we show how a programmer can extract services, add fault tolerance functionality, and adapt client code to invoke cloud services via refactorings integrated with a modern IDE. As a validation, we have applied our approach to automatically transform two third-party Java applications to use cloud-based services. We have also applied our approach to re-engineer a suite of services operated by General Electric to use cloud-based resources to better satisfy the GE business requirements. 相似文献
16.
A computer program for the automated design of frameworks in steel tier buildings is described and demonstrated. The design process commences with the input of any initial set of member sies for a given geometry: it is not necessary to begin with good estimates. Cyclic analyses of the building frame and revisions of member sizes then follow. The three-dimensional analysis of the building frame includes the effects of the finite dimensions of moment-resisting connections. Within each cycle of design, wide-flange members are selected on the basis of satisfying the dead- and live-load stress requirements of the 1969 AISC Specification for Structural Steel in Buildings. Each member is then checked for the most critical combination of vertical and lateral loading. The lightest satisfactory size within a prespecified range of sizes is ultimately selected. The output consists of beam and column schedules that show the final sizes and the design conditions leading to their selection. Sample three-story and twenty-story building designs show consistent and rapid convergence to a final design without human intervention between consecutive cycles. With highrise buildings becoming increasingly prevalent, an economical automated design procedure should be of great value to the practicing structural engineer. 相似文献
17.
Protective packaging forms an important integral part in the materials handling process of ensuring that goods are transferred safely from the source to the point of use. This paper focuses on the procedural design practices for protective packaging which are predominantly manual and involves the use of implicit design rules, and is therefore amenable to design automation efforts. PROPACK, a protective packaging CAD software program for expanded styropor material has been developed by coupling various existing commercial software packages for drafting, analysis, database management, and knowledge based problem solving and consultation. In so doing, it exploits the well-proven and stable features of these tools for the different activities and stages of design. The coupling of the various packages to form an integrated system is achieved either by the creation of task specific interfaces between packages, or by making use of existing interfaces provided in some of these packages. The relative merits of adopting this approach are also discussed. 相似文献
20.
This paper describes the use of i-CAD, a prototype tool for automatically synthesizing application specific intranets. i-CAD is a novel intranet computer-aided design software tool, and its ultimate goal is to concurrently design hierarchical network topologies and data management (content distribution) systems for data-intensive multimedia intranets. The prototype software tool introduced here synthesizes a three-level intranet architecture that entails minimal installation cost and yet enables all an intranet's clients to perform their tasks with acceptable performance. The tool chooses network technologies (hardware resources and protocols) based on requirements specified by the user and determines the topology. An evolutionary approach is used to search the design space for a minimal cost three-level network. The experimental results for several network design problems described here indicate the effectiveness of the prototype network tool in finding good designs from a large design space in a reasonable amount of time. 相似文献
|