首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 15 毫秒
1.
One purpose of software metrics is to measure the quality of programs. The results can be for example used to predict maintenance costs or improve code quality. An emerging view is that if software metrics are going to be used to improve quality, they must help in finding code that should be refactored. Often refactoring or applying a design pattern is related to the role of the class to be refactored. In client-based metrics, a project gives the class a context. These metrics measure how a class is used by other classes in the context. We present a new client-based metric LCIC (Lack of Coherence in Clients), which analyses if the class being measured has a coherent set of roles in the program. Interfaces represent the roles of classes. If a class does not have a coherent set of roles, it should be refactored, or a new interface should be defined for the class.We have implemented a tool for measuring the metric LCIC for Java projects in the Eclipse environment. We calculated LCIC values for classes of several open source projects. We compare these results with results of other related metrics, and inspect the measured classes to find out what kind of refactorings are needed. We also analyse the relation of different design patterns and refactorings to our metric. Our experiments reveal the usefulness of client-based metrics to improve the quality of code.  相似文献   

2.
Test suites are a valuable source of up-to-date documentation as developers continuously modify them to reflect changes in the production code and preserve an effective regression suite. While maintaining traceability links between unit test and the classes under test can be useful to selectively retest code after a change, the value of having traceability links goes far beyond this potential savings. One key use is to help developers better comprehend the dependencies between tests and classes and help maintain consistency during refactoring. Despite its importance, test-to-code traceability is not common in software development and, when needed, traceability information has to be recovered during software development and evolution. We propose an advanced approach, named SCOTCH+ (Source code and COncept based Test to Code traceability Hunter), to support the developer during the identification of links between unit tests and tested classes. Given a test class, represented by a JUnit class, the approach first exploits dynamic slicing to identify a set of candidate tested classes. Then, external and internal textual information associated with the classes retrieved by slicing is analyzed to refine this set of classes and identify the final set of candidate tested classes. The external information is derived from the analysis of the class name, while internal information is derived from identifiers and comments. The approach is evaluated on five software systems. The results indicate that the accuracy of the proposed approach far exceeds the leading techniques found in the literature.  相似文献   

3.
Schmid  H.A. 《Software, IEEE》1996,13(6):67-75
A framework is a set of object classes that collaborate to carry out a set of responsibilities; it reuses both the high level design of a program and its implementation. Frameworks are classified by application and domain and, depending on how an application is created, as either white box or black box. The manufacturing application framework described, lets you develop software from components without programming. The framework's design generalizes the class structure which models a fixed domain application through a sequence of transformations  相似文献   

4.
The extraction of a code fragment into a separate method is one of the most widely performed refactoring activities, since it allows the decomposition of large and complex methods and can be used in combination with other code transformations for fixing a variety of design problems. Despite the significance of Extract Method refactoring towards code quality improvement, there is limited support for the identification of code fragments with distinct functionality that could be extracted into new methods. The goal of our approach is to automatically identify Extract Method refactoring opportunities which are related with the complete computation of a given variable (complete computation slice) and the statements affecting the state of a given object (object state slice). Moreover, a set of rules regarding the preservation of existing dependences is proposed that exclude refactoring opportunities corresponding to slices whose extraction could possibly cause a change in program behavior. The proposed approach has been evaluated regarding its ability to capture slices of code implementing a distinct functionality, its ability to resolve existing design flaws, its impact on the cohesion of the decomposed and extracted methods, and its ability to preserve program behavior. Moreover, precision and recall have been computed employing the refactoring opportunities found by independent evaluators in software that they developed as a golden set.  相似文献   

5.
The Visitor pattern is a behavioral software design pattern where different objects represent an operation to be performed on elements of an object structure. Despite the benefits of the Visitor pattern, its rigid structure has limitations. Owing to the Visitor pattern's usefulness and importance to software design, many researchers have extended and modified the original Visitor pattern to overcome its limitations. Researchers have even replaced the Visitor pattern with more refined design patterns (e.g., Reflective Visitor pattern, Java Walkabout Class, and Dynamic Dispatcher) that bear minimal resemblance to the original Visitor pattern's structure while retaining its major advantages (e.g., ability to add new operations to an object structure without changing the classes of objects, localizing related behavior, and accumulating state). This article therefore provides a comprehensive survey of the Visitor pattern for software practitioners. Within the survey, we focus on major enhancements that have been made to the original Visitor pattern to overcome its limitations. On the basis of our survey results, we found that variations of the Visitor pattern can be separated into two categories: extended Visitor patterns where the original Visitor pattern structure stays intact and alternative Visitor patterns where the structure of the original Visitor pattern is altered. Copyright © 2012 John Wiley & Sons, Ltd.  相似文献   

6.
This paper presents an analysis of the design of classifiers for use in a hierarchical object recognition approach. In this approach, a cascade of classifiers is arranged in a tree in order to recognize multiple object classes. We are interested in the problem of recognizing multiple patterns as it is closely related to the problem of locating an articulated object. Each different pattern class corresponds to the hand in a different pose, or set of poses. For this problem obtaining labelled training data of the hand in a given pose can be problematic. Given a parametric 3D model, generating training data in the form of example images is cheap, and we demonstrate that it can be used to design classifiers almost as good as those trained using non-synthetic data. We compare a variety of different template-based classifiers and discuss their merits.  相似文献   

7.
Representing design decisions for complex software systems, tracing them to code, and enforcing them throughout the lifecycle are pressing concerns for software architects and developers. To be of practical use, specification and modeling languages for software design need to combine rigor with abstraction and simplicity, and be supported by automated design verification tools that require minimal human intervention. This paper examines closely the use of the visual language of Codecharts for representing design decisions and demonstrate the process of verifying the conformance of a program to the chart. We explicate the abstract semantics of segments of the Java package java.awt as a finite structures, specify the Composite design pattern as a Codechart and unpack it as a set of formulas, and prove that the structure representing the program satisfies the formulas. We also describe a set of tools for modeling design patterns with Codecharts and for verifying the conformance of native (plain) Java programs to the charts.  相似文献   

8.
Uwe Zdun 《Software》2007,37(9):983-1016
Software patterns provide reusable solutions to recurring design problems in a particular context. The software architect or designer must find the relevant patterns and pattern languages that need to be considered, and select the appropriate patterns, as well as the best order to apply them. If the patterns and pattern languages are written by multiple pattern authors, it might be necessary to identify interdependencies and overlaps between these patterns and pattern languages first. Out of the possible multitude of patterns and pattern combinations that might provide a solution to a particular design problem, one fitting solution must be selected. This can only be mastered with a sufficient expertise for both the relevant patterns and the domain in which they are applied. To remedy these issues we provide an approach to support the selection of patterns based on desired quality attributes and systematic design decisions based on patterns. We propose to formalize the pattern relationships in a pattern language grammar and to annotate the grammar with effects on quality goals. In a second step, complex design decisions are analyzed further using the design spaces covered by a set of related software patterns. This approach helps to systematically find and categorize the appropriate software patterns—possibly even from different sources. As a case study of our approach, we analyze patterns from a pattern language for distributed object middleware. Copyright © 2006 John Wiley & Sons, Ltd.  相似文献   

9.
Type-directed programming is an important and widely used paradigm in the design of software. With this form of programming, an application may analyze type information to determine its behavior. By analyzing the structure of data, many operations, such as serialization, cloning, adaptors and iterators may be defined once, for all types of data. That way, as the program evolves, these operations need not be updated—they will automatically adapt to new data forms. Otherwise, each of these operations must be individually redefined for each type of data, forcing programmers to revisit the same program logic many times during a program's lifetime.The Java language supports type directed programming with the instanceof operator and the Java Reflection API. These mechanisms allow Java programs to depend on the name and structure of the run-time classes of objects. However, the Java mechanisms for type-directed programming are difficult to use. They also do not integrate well with generics, an important new feature of the Java language.In this paper, we describe the design of several expressive new mechanisms for type-directed programming in Java, and show that these mechanisms are sound when included in a language similar to Featherweight Java. Basically, these new mechanisms pattern-match the name and structure of the type parameters of generic code, instead of the run-time classes of objects. Therefore, they naturally integrate with generics and provide strong guarantees about program correctness. As these mechanisms are based on pattern matching, they naturally and succinctly express many operations that depend on type information. Finally, they provide programmers with some degree of protection for their abstractions. Whereas instanceof and reflection can determine the exact run-time type of an object, our mechanisms allow any supertype to be supplied for analysis, hiding its precise structure.  相似文献   

10.
11.
BackgroundSoftware Change Impact Analysis (CIA) is an essential technique in software engineering to identifying the potential influences of a change, or determining change entities to accomplish such a change. The results derived, in many cases, ambiguous for the software maintainers, introduces the problem of unclear starting point of these impacted entities.ObjectiveIn an attempt to address this issue, this work proposes a novel approach for cross-level CIA, producing a ranked list of potentially impacted methods derived from class-level changes. Moreover, the approach of ranking the impact results is expected to be effective for maintainers to distinguish the probability of the impacted methods to be false-positives. Such results provide an eclectic approach for CIA.MethodThe approach, FCA–CIA, uses formal concept analysis (FCA) to produce an intermediate representation of the program based on the static analysis of the source code. The representation is called Lattice of Class and Method Dependence (LoCMD). FCA–CIA takes the changed classes in the change set as a whole, and determines the reachable set from the changed classes on the LoCMD. Based on the hierarchical property of the LoCMD, the impacted methods are ranked according to the impact factor metric which corresponds to the priority of these methods to be inspected.ResultEmpirical evaluations on four real-world software projects demonstrate the effectiveness of the impact factor metric and the FCA–CIA technique. The result shows the predicted impacted methods with higher impact factor values are more likely to be affected by the changes. Our study also shows that the FCA–CIA technique generates more accurate impact set than the JRipples and ICP coupling based CIA technique.  相似文献   

12.
Graph transformations for object-oriented refinement   总被引:2,自引:0,他引:2  
An object-oriented program consists of a section of class declarations and a main method. The class declaration section represents the structure of an object-oriented program, that is the data, the classes and relations among them. The execution of the main method realizes the application by invoking methods of objects of the classes defined in the class declarations. Class declarations define the general properties of objects and how they collaborate with each other in realizing the application task programmed as the main method. Note that for one class declaration section, different main methods can be programmed for different applications, and this is an important feature of reuse in object-oriented programming. On the other hand, different class declaration sections may support the same applications, but these different class declaration sections can make significant difference with regards to understanding, reuse and maintainability of the applications. With a UML-like modeling language, the class declaration section of a program is represented as a class diagram, and the instances of the class diagram are represented by object diagrams, that form the state space of the program. In this paper, we define a class diagram and its object diagrams as directed labeled graphs, and investigate what changes in the class structure maintain the capability of providing functionalities (or services). We formalize such a structure change by the notion of structure refinement. A structure refinement is a transformation from one graph to another that preserves the capability of providing services, that is, the resulting class graph should be able to provide at least as many, and as good, services (in terms of functional refinement) as the original graph. We then develop a calculus of object-oriented refinement, as an extension to the classical theory of data refinement, in which the refinement rules are classified into four categories according to their natures and uses in object-oriented software design. The soundness of the calculus is proved and the completeness of the refinement rules of each category is established with regard to normal forms defined for object-oriented programs. These completeness results show the power of the simple refinement rules. The normal forms and the completeness results together capture the essence of polymorphism, dynamic method binding and object sharing by references in object-oriented computation.  相似文献   

13.
基于设计模式,角色对象模式是Composite模式和Decorate模式复合得到的新模式。角色对象模式将一个系统中的各级用户划分成不同对象,分别描述各对象的权限,并提供管理功能,从而降低程序耦合度,使系统结构清晰,易于维护。本文介绍了角色对象模式在电力监控系统中的应用。  相似文献   

14.
An automated approach to the synthesis of Boolean control functions is proposed; this approach makes it possible to obtain the table of states and their analytical expressions for an arbitrary commutation method for switch elements with subsequent transmission of results to simulation and automated design systems. The program realization of the method is performed using Mathematica.  相似文献   

15.
《Computers & Geosciences》2006,32(9):1499-1511
A program, EMOD2D, in C++, is developed to compute the apparent resistivities of two-dimensional geological structures for magnetotelluric (MT) H-polarization case, using finite difference technique. Five C++ classes with member functions are designed to compute apparent resistivitiy values. The program utilizes object oriented programming features such as multiple inheritance, encapsulation to allow the user to easily deploy and modify the given classes. This program has been used to study the responses of various ore deposit models. This modelling study is relevant to: (i) search for mineral deposits underlying conductive or resistive overburden, (ii) understand the response pattern for the ore body with different depths and conductivities, and (iii) study the response pattern for the ore body when it is in contact and without contact with the overburden. The program is compiled on Borland C++.  相似文献   

16.
Software patterns are a new design paradigm used to solve problems that arise when developing software within a particular context. Patterns capture the static and dynamic structure and collaboration among the components in a software design. A key promise of the pattern‐based approach is that it may greatly simplify the construction of software systems out of building blocks and thus reuse experience and reduce cost. However, it also introduces significant problems in ensuring the integrity and reliability of these composed systems because of their complex software topologies, interactions and transactions. There is a need to capture these features as a contract through a formal model that allows us to analyze pattern‐based designs. In this paper, we provide an overview of a formal framework for ensuring the integrity of the compositions in object‐oriented designs by providing mathematically rigorous modeling and analysis techniques for object‐oriented systems comprising pattern‐based designs as the basic building blocks or design components. A case study related to a hypermedia Web‐based application has been presented to illustrate our approach in distributed systems. Copyright © 2005 John Wiley & Sons, Ltd.  相似文献   

17.
Traits offer a fine-grained mechanism to compose classes from reusable components while avoiding problems of fragility brought by multiple inheritance and mixins. Traits as originally proposed are stateless, that is, they contain only methods, but no instance variables. State can only be accessed within stateless traits by accessors, which become required methods of the trait. Although this approach works reasonably well in practice, it means that many traits, viewed as software components, are artificially incomplete, and classes that use such traits may contain significant amounts of boilerplate glue code. We present an approach to stateful traits that is faithful to the guiding principle of stateless traits: the client retains control of the composition. Stateful traits consist of a minimal extension to stateless traits in which instance variables are purely local to the scope of a trait, unless they are explicitly made accessible by the composing client of a trait. We demonstrate by means of a formal object calculus that adding state to traits preserves the flattening property: traits contained in a program can be compiled away. We discuss and compare two implementation strategies, and briefly present a case study in which stateful traits have been used to refactor the trait-based version of the Smalltalk collection hierarchy.  相似文献   

18.
Software changes during its lifetime. Likewise, software models change during their design time, e.g. by removing, adding or changing operations and classes. This is referred to as model evolution. In a refinement-based approach to software design, we moreover do not deal with a single but with a chain of models (viz. formal specifications), related via refinement. Changes thus need to be consistently made to all specifications in the chain so as to keep the refinement structure.In this paper, we develop co-evolutions of models in the context of the formal method Object-Z. More specifically, given a particular evolution of a specification we show how to construct a corresponding evolution for its refinements such that the refinement relationship is kept. A chain of models can thus be systematically and consistently evolved, while maintaining the given refinement structure.  相似文献   

19.
One of the main goals of design patterns is to design for change. Many design patterns leave some room for future changes and evolutions. The application of design patterns leads to adaptable software since the design pattern instances could be changed with minimal impact on other parts of the system. Such changes, called the evolution of a design pattern instance in this paper, typically involve the addition or removal of a group of model elements, such as classes, attributes, operations, and relationships. However, the possible evolutions of each design pattern are often not explicitly documented. Missing a part of the evolution process may result in inconsistent evolutions. In this paper, we present our approach to assist the evolution processes of design patterns by model transformation technology. We provide a formal foundation for our approach by defining the predicates that can be used to describe the properties of each design pattern, software system design, and design pattern evolutions. We also provide tool support to automate the evolution processes based on the Query, View, and Transformation standard. A case study of a large open-source software system is conducted to illustrate and evaluate our approach.  相似文献   

20.
一种基于切片技术度量Java耦合性的框架   总被引:7,自引:0,他引:7  
在研究面向对象的度量问题时,人们通过简单的统计方法和基于信息源的方法来度量其中的一些特征,例如基本度量、CK度量和AoKi度量等。文中采用一种基于程序切片的方法来度量Java的耦合性问题,通过对J ava源程序中存在的耦合关系的度量,得到了一种比传统方法更精确的耦合度量方法。  相似文献   

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

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