Refactoring tools, whether fully automated or semi-automated, are essential components of the software development life cycle. As software libraries and frameworks evolve over time, it’s crucial for programs utilizin...Refactoring tools, whether fully automated or semi-automated, are essential components of the software development life cycle. As software libraries and frameworks evolve over time, it’s crucial for programs utilizing them to also evolve to remain compatible with modern advancements. Take, for example, NVIDIA CUDA’s platform for general-purpose GPU programming. Embracing the more contemporary unified memory architecture offers several benefits, such as simplifying program source code, reducing bugs stemming from manual memory management between host and device memory, and optimizing memory transfer through automated memory handling. This paper describes our development of a refactoring tool based on Clang’s Libtooling to facilitate this transition automatically, thereby relieving developers from the burden and risks associated with manually refactoring large code bases.展开更多
The unceasing change problem of land information systems can be resolved through the refactoring and design pattern. To promote the implementation of design pattern and refactoring methods in developing land informati...The unceasing change problem of land information systems can be resolved through the refactoring and design pattern. To promote the implementation of design pattern and refactoring methods in developing land information systems reusing software design, applying refactoring methods to the abstract factory and decorator design patterns in land information system development is discussed.展开更多
Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional s...Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional statements are selected, and they are the factory method pattern and the strategy pattem. Two pattern-directed refactoring approaches based on the two design patterns are proposed. Each approach contains a refactoring opportunities identification algorithm and an automated refactoring algorithm. After parsing the abstract syntax tree generated from source code, the refactoring opportunities are identified effectively and automatically. Then, for candidate code, refactoring algorithms are executed automatically, which are used to simplify or remove complex conditional statements. By empirical analysis and quality assessment, the code after refactoring has better maintainability and extensibility, and the proposed approach for automated pattern-directed refactoring succeeds to reduce code size and complexity of classes.展开更多
In order to deal with the complex association relationships between classes in an object-oriented software system,a novel approach for identifying refactoring opportunities is proposed.The approach can be used to dete...In order to deal with the complex association relationships between classes in an object-oriented software system,a novel approach for identifying refactoring opportunities is proposed.The approach can be used to detect complex and duplicated many-to-many association relationships in source code,and to provide guidance for further refactoring.In the approach,source code is first transformed to an abstract syntax tree from which all data members of each class are extracted,then each class is characterized in connection with a set of association classes saving its data members.Next,classes in common associations are obtained by comparing different association classes sets in integrated analysis.Finally,on condition of pre-defined thresholds,all class sets in candidate for refactoring and their common association classes are saved and exported.This approach is tested on 4 projects.The results show that the precision is over 96%when the threshold is 3,and 100%when the threshold is 4.Meanwhile,this approach has good execution efficiency as the execution time taken for a project with more than 500 classes is less than 4 s,which also indicates that it can be applied to projects of different scales to identify their refactoring opportunities effectively.展开更多
A global variable in C/C++ is one that is declared outside a function, and whose scope extends the lifetime of the entire program. Global variables cause problems for program dependability, maintainability, extensibil...A global variable in C/C++ is one that is declared outside a function, and whose scope extends the lifetime of the entire program. Global variables cause problems for program dependability, maintainability, extensibility, verification, and thread-safety. However, global variables can also make coding more convenient and improve program performance. We have found the use of global variables to remain unabated and extensive in real-world software. In this paper we present a source-to-source refactoring tool to automatically detect and localize global variables in a program. We implement a compiler based transformation to find the best location to redefine each global variable as a local. For each global, our algorithm initializes the corresponding new local variable, passes it as an argument to necessary functions, and updates the source lines that used the global to now instead use the corresponding local or argument. We also characterize the use of global variables in standard benchmark programs. We study the effect of our transformation on static program properties, such as change in the number of function arguments and program state visibility. Additionally, we quantify dynamic program features, including memory and runtime performance, before and after our localizing transformation.展开更多
Ultrasonic rolling is an advanced non-cutting surface strengthening method that combines traditional rolling with ultrasonic vibration.In this research,the experiment of orthogonal end milling-ultrasonic rolling compo...Ultrasonic rolling is an advanced non-cutting surface strengthening method that combines traditional rolling with ultrasonic vibration.In this research,the experiment of orthogonal end milling-ultrasonic rolling composite process has been carried out.The surface integrity refactoring changes and its mechanism of Ti-17 titanium alloy during the milling-ultrasonic rolling composite process has been studied and analyzed by the test and analysis of the surface geometric characteristics,residual stress,microhardness and microstructure before and after ultrasonic rolling.The residual stress and microhardness gradient distribution were characterized by cosine decay function and exponential decay function.All indicators of surface integrity were significantly improved after ultrasonic rolling.The study demonstrates that the reduction effect of the surface roughness by ultrasonic rolling process is inversely proportional to the initial surface roughness value.The ultrasonic rolling can only change the distribution form of the surface topography when the initial surface roughness is small.In addition,the improvement effect of ultrasonic rolling on surface compressive residual stress and microhardness decreased with the increase of initial milled surface roughness and surface compressive residual stress due to the factors such as energy absorption efficiency and mechanical properties changes of surface materials.A better ultrasonic rolled surface can be obtained by controlling the roughness and residual compressive stress of the initial milling surface to a small level.展开更多
An intrinsic property of software in a real-world environment is its need to evolve, which is usually accompanied by the increase of software complexity and deterioration of software quality, making software maintenan...An intrinsic property of software in a real-world environment is its need to evolve, which is usually accompanied by the increase of software complexity and deterioration of software quality, making software maintenance a tough problem. Refactoring is regarded as an effective way to address this problem. Many refactoring approaches at the method and class level have been proposed. But the research on software refactoring at the package level is very little. This paper presents a novel approach to refactor the package structures of object oriented software. It uses software networks to represent classes and their dependencies. It proposes a constrained community detection algorithm to obtain the optimized community structures in software networks, which also correspond to the optimized package structures. And it finally provides a list of classes as refactoring candidates by comparing the optimized package structures with the real package structures. The empirical evaluation of the proposed approach has been performed in two open source Java projects, and the benefits of our approach are illustrated in comparison with the other three approaches.展开更多
Software product line (SPL) is an approach used to develop a range of software products with a high degree of similarity. In this approach, a feature model is usually used to keep track of similarities and differenc...Software product line (SPL) is an approach used to develop a range of software products with a high degree of similarity. In this approach, a feature model is usually used to keep track of similarities and differences. Over time, as modifications are made to the SPL, inconsistencies with the feature model could arise. The first approach to dealing with these inconsistencies is refactoring. Refactoring consists of small steps which, when accumulated, may lead to large-scale changes in the SPL, resulting in features being added to or eliminated from the SPL. In this paper, we propose a framework for refactoring SPLs, which helps keep SPLs consistent with the feature model. After some introductory remarks, we describe a formal model for representing the feature model. We express various refactoring patterns applicable to the feature model and the SPL formally, and then introduce an algorithm for finding them in the SPL. In the end, we use a real-world case study of an SPL to illustrate the applicability of the framework introduced in the paper.展开更多
Virtual routers are gaining increasing attention in the research field of future networks. As the core network device to achieve network virtualization, virtual routers have multiple virtual instances coexisting on a ...Virtual routers are gaining increasing attention in the research field of future networks. As the core network device to achieve network virtualization, virtual routers have multiple virtual instances coexisting on a physical router platform, and each instance retains its own forwarding information base (FIB). Thus, memory scalability suffers from the limited on-chip memory. In this paper, we present a splitting-after-merging approach to compress the FIBs, which not only improves the memory efficiency but also offers an ideal split position to achieve system refactoring. Moreover, we propose an improved strategy to save the time used for system rebuilding to achieve fast refactoring. Experiments with 14 real-world routing data sets show that our approach needs only a unibit trie holding 134 188 nodes, while the original number of nodes is 4 569 133. Moreover, our approach has a good performance in scalability, guaranteeing 90 000 000 prefixes and 65 600 FIBs.展开更多
Extract method is one of the most popular soft- ware refactorings. However, little work has been done to investigate or validate the major motivations for such refactorings. Digging into this issue might help research...Extract method is one of the most popular soft- ware refactorings. However, little work has been done to investigate or validate the major motivations for such refactorings. Digging into this issue might help researchers to improve tool support for extract method refactorings, e.g., proposing better tools to recommend refactoring opportunities, and to select fragments to be extracted. To this end, we conducted an interview with 25 developers, and our results suggest that current reuse, decomposition of long methods, clone resolution, and future reuse are the major motivations for extract method refactorings. We also validated the results by analyzing the refactoring history of seven open-source applications. Analysis results suggest that current reuse was the primary motivation for 56% of extract method refactorings, decomposition of methods was the primary motivation for 28% of extract method refactorings, and clone resolution was the primary motivation for 16% of extract method refactorings. These findings might suggest that recommending extract method opportunities by analyzing only the inner structure (e.g., complexity and length) of methods alone would miss many extract method opportunities. These findings also suggest that extract method refactorings are often driven by current and immediate reuse. Consequently, how to recognize or predict reuse requirements timely during software evolution may play a key role in the recommendation and automation of extract method refactorings. We also investigated the likelihood for the extracted methods to be reused in future, and our results suggest that such methods have a small chance (12%) to be reused in future unless the extracted fragment could be reused immediately in software evolution and extracting such a fragment can resolve existing clones at the same time.展开更多
Model-Based Development has become an industry wide standard paradigm.As an open source alternative,Scilab/Xcos is being widely employed as a hybrid dynamic systems modeling tool.With the increasing efficiency in impl...Model-Based Development has become an industry wide standard paradigm.As an open source alternative,Scilab/Xcos is being widely employed as a hybrid dynamic systems modeling tool.With the increasing efficiency in implementation using graphical model development and code generation,the modeling and simulation community is struggling with assuring quality as well as maintainability and extendibility.Refactoring is defined as an evolutionary modernization activity where,most of the time,the structure of the artifact is changed to alter its quality characteristics,while keeping its behavior unchanged.It has been widely established as a technique for textual programming languages to improve the code structure and quality.While refactoring is also regarded as one of the key practices of model engineering,the methodologies and approaches for model refactoring are still under development.Architecture-Driven Modernization(ADM)has been introduced by the software engineering community as a model-based approach to software modernization,in which the implicit information that lies in software artifacts is extracted to models and model transformations are applied for modernization tasks.Regarding refactoring as a low level modernization task,the practices from ADM are adaptable.Accordingly,this paper proposes a model-based approach for model refactoring in order to come up with more efficient and effective model refactoring methodology that is accessible and extendable by modelers.Like other graphical modeling tools,Scilab/Xcos also possesses a formalized model specification conforming to its implicit metamodel.Rather than proposing another metamodel for knowledge extraction,this pragmatic approach proposes to conduct in place model-to-model transformations for refactoring employing the Scilab/Xcos model specification.To construct a structured model-based approach,the implicit Scilab/Xcos metamodel is explicitly presented utilizing ECORE as a meta-metamodel.Then a practical model transformation approach is established based on Scilab scripting.A Scilab toolset is provided to the modeler for in-place model-to-model transformations.Using a sample case study,it is demonstrated that proposed model transformation functions in Scilab provide a valuable refactoring tool.展开更多
Designing and optimizing complex scientific code for new computing architectures is a challenging task. To address this issue in the E3SM land model (ELM) development, we developed a software tool called SPEL, which f...Designing and optimizing complex scientific code for new computing architectures is a challenging task. To address this issue in the E3SM land model (ELM) development, we developed a software tool called SPEL, which facilitates code generation, verification, and performance tuning using compiler directives within a Function Unit Test framework. In this paper, we present a SPEL extension that leverages the version control system (e.g., Git) to autonomous code generation and demonstrate its application to continuous code integration and development of the ELM software system. The study can benefit the scientific software development community.展开更多
Reusing code fragments by copying and pasting them with or without minor adaptation is a common activity in software development.As a result,software systems often contain sections of code that are very similar,called...Reusing code fragments by copying and pasting them with or without minor adaptation is a common activity in software development.As a result,software systems often contain sections of code that are very similar,called code clones.Code clones are beneficial in reducing software development costs and development risks.However,recent studies have indicated some negative impacts as a result.In order to effectively manage and utilize the clones,we design an approach for recommending refactoring clones based on a Bayesian network.Firstly,clone codes are detected from the source code.Secondly,the clones that need to be refactored are identified,and the static and evolutions features are extracted to build the feature database.Finally,the Bayesian network classifier is used for training and evaluating the classification results.Based on more than 640 refactor examples of five open source software developed in C,we observe a considerable enhancement.The results show that the accuracy of the approach is larger than 90%.We believe our approach will provide a more accurate and reasonable code refactoring and maintenance advice for software developers.展开更多
Software modularization is a technique used to divide a software system into independent modules (packages)that are expected to be cohesive and loosely coupled. However, as software systems evolve over time to meet ...Software modularization is a technique used to divide a software system into independent modules (packages)that are expected to be cohesive and loosely coupled. However, as software systems evolve over time to meet new require-ments, their modularizations become complex and gradually loose their quality. Thus, it is challenging to automaticallyoptimize the classes' distribution in packages, also known as remodularization. To alleviate this issue, we introduce a newapproach to optimize software modularization by moving classes to more suitable packages. In addition to improving designquality and preserving semantic coherence, our approach takes into consideration the refactoring effort as an objective initself while optimizing software modularization. We adapt the Elitist Non-dominated Sorting Genetic Algorithm (NSGA-Ⅱ)of Deb et al. to find the best sequence of refactorings that 1) maximize structural quality, 2) maximize semantic cohesivenessof packages (evaluated by a semantic measure based on WordNet), and 3) minimize the refactoring effort. We report theresults of an evaluation of our approach using open-source projects, and we show that our proposal is able to produce acoherent and useful sequence of recommended refactorings both in terms of quality metrics and from the developer's pointsof view.展开更多
Code smell is the product of improper design and operation,which may be introduced in many situations.It will cause serious problems for further software development and maintenance.Currently,most code smell detection...Code smell is the product of improper design and operation,which may be introduced in many situations.It will cause serious problems for further software development and maintenance.Currently,most code smell detection methods detect through a single type of software data.There are restrictions on detecting code smells with complex definitions and characteristics.In this paper,an approach of applying multi-dimensional software data is proposed.A complex network was built through structural data and historical version data,and code smell instances were determined by searching the network.We designed two smells detection strategies were designed and evaluated them in four open source projects.The results demonstrate that the proposed method has 23%and 15%higher F-measures on Shotgun Surgery and Parallel Inheritance Hierarchy than the existing mainstream detection ways.The code smell detection based on multi-dimensional software data and complex network is effective,and this method of processing multidimensional software data is also applicable for data-driven software research.展开更多
Methods in programs must be accurately named to facilitate source code analysis and comprehension.With the evolution of software,method names may be inconsistent with their implemented method bodies,leading to inaccur...Methods in programs must be accurately named to facilitate source code analysis and comprehension.With the evolution of software,method names may be inconsistent with their implemented method bodies,leading to inaccurate or buggy method names.Debugging method names remains an important topic in the literature.Although researchers have proposed several approaches to suggest accurate method names once the method bodies have been modified,two main drawbacks remain to be solved:there is no analysis of method name structure,and the programming context information is not captured efficiently.To resolve these drawbacks and suggest more accurate method names,we propose a novel automated approach based on the analysis of the method name structure and lexical analysis with the programming context information.Our approach first leverages deep feature representation to embed method names and method bodies in vectors.Then,it obtains useful verb-tokens from a large method corpus through structural analysis and noun-tokens from method bodies through lexical analysis.Finally,our approach dynamically combines these tokens to form and recommend high-quality and project-specific method names.Experimental results over 2111 Java testing methods show that the proposed approach can achieve a Hit Ratio,or Hit@5,of 33.62%and outperform the state-of-the-art approach by 14.12%in suggesting accurate method names.We also demonstrate the effectiveness of structural and lexical analyses in our approach.展开更多
文摘Refactoring tools, whether fully automated or semi-automated, are essential components of the software development life cycle. As software libraries and frameworks evolve over time, it’s crucial for programs utilizing them to also evolve to remain compatible with modern advancements. Take, for example, NVIDIA CUDA’s platform for general-purpose GPU programming. Embracing the more contemporary unified memory architecture offers several benefits, such as simplifying program source code, reducing bugs stemming from manual memory management between host and device memory, and optimizing memory transfer through automated memory handling. This paper describes our development of a refactoring tool based on Clang’s Libtooling to facilitate this transition automatically, thereby relieving developers from the burden and risks associated with manually refactoring large code bases.
基金Funded by the National Natural Science Foundation of China (No.40671122, No.40671130) and the National Key Developing Program for Basic Sciences of China (No.2006CB701302).
文摘The unceasing change problem of land information systems can be resolved through the refactoring and design pattern. To promote the implementation of design pattern and refactoring methods in developing land information systems reusing software design, applying refactoring methods to the abstract factory and decorator design patterns in land information system development is discussed.
文摘Complex conditional statement is one of the bad code smells, which affects the quality of the code and design of software. In the proposed approach, two commonly-used design patterns for handling complex conditional statements are selected, and they are the factory method pattern and the strategy pattem. Two pattern-directed refactoring approaches based on the two design patterns are proposed. Each approach contains a refactoring opportunities identification algorithm and an automated refactoring algorithm. After parsing the abstract syntax tree generated from source code, the refactoring opportunities are identified effectively and automatically. Then, for candidate code, refactoring algorithms are executed automatically, which are used to simplify or remove complex conditional statements. By empirical analysis and quality assessment, the code after refactoring has better maintainability and extensibility, and the proposed approach for automated pattern-directed refactoring succeeds to reduce code size and complexity of classes.
文摘In order to deal with the complex association relationships between classes in an object-oriented software system,a novel approach for identifying refactoring opportunities is proposed.The approach can be used to detect complex and duplicated many-to-many association relationships in source code,and to provide guidance for further refactoring.In the approach,source code is first transformed to an abstract syntax tree from which all data members of each class are extracted,then each class is characterized in connection with a set of association classes saving its data members.Next,classes in common associations are obtained by comparing different association classes sets in integrated analysis.Finally,on condition of pre-defined thresholds,all class sets in candidate for refactoring and their common association classes are saved and exported.This approach is tested on 4 projects.The results show that the precision is over 96%when the threshold is 3,and 100%when the threshold is 4.Meanwhile,this approach has good execution efficiency as the execution time taken for a project with more than 500 classes is less than 4 s,which also indicates that it can be applied to projects of different scales to identify their refactoring opportunities effectively.
文摘A global variable in C/C++ is one that is declared outside a function, and whose scope extends the lifetime of the entire program. Global variables cause problems for program dependability, maintainability, extensibility, verification, and thread-safety. However, global variables can also make coding more convenient and improve program performance. We have found the use of global variables to remain unabated and extensive in real-world software. In this paper we present a source-to-source refactoring tool to automatically detect and localize global variables in a program. We implement a compiler based transformation to find the best location to redefine each global variable as a local. For each global, our algorithm initializes the corresponding new local variable, passes it as an argument to necessary functions, and updates the source lines that used the global to now instead use the corresponding local or argument. We also characterize the use of global variables in standard benchmark programs. We study the effect of our transformation on static program properties, such as change in the number of function arguments and program state visibility. Additionally, we quantify dynamic program features, including memory and runtime performance, before and after our localizing transformation.
基金supported by the National Natural Science Foundation of China(Grant Nos.51875472,91860206,51905440,and 92160301)the National Science and Technology Major Project(Grant No.2017-VII-0001-0094)the Key Research and Development Program of Shaanxi Province(Grant No.2021ZDLGY10-06).
文摘Ultrasonic rolling is an advanced non-cutting surface strengthening method that combines traditional rolling with ultrasonic vibration.In this research,the experiment of orthogonal end milling-ultrasonic rolling composite process has been carried out.The surface integrity refactoring changes and its mechanism of Ti-17 titanium alloy during the milling-ultrasonic rolling composite process has been studied and analyzed by the test and analysis of the surface geometric characteristics,residual stress,microhardness and microstructure before and after ultrasonic rolling.The residual stress and microhardness gradient distribution were characterized by cosine decay function and exponential decay function.All indicators of surface integrity were significantly improved after ultrasonic rolling.The study demonstrates that the reduction effect of the surface roughness by ultrasonic rolling process is inversely proportional to the initial surface roughness value.The ultrasonic rolling can only change the distribution form of the surface topography when the initial surface roughness is small.In addition,the improvement effect of ultrasonic rolling on surface compressive residual stress and microhardness decreased with the increase of initial milled surface roughness and surface compressive residual stress due to the factors such as energy absorption efficiency and mechanical properties changes of surface materials.A better ultrasonic rolled surface can be obtained by controlling the roughness and residual compressive stress of the initial milling surface to a small level.
基金supported by National Natural Science Foundation of China(No. 61202048)Zhejiang Provincial Nature Science Foundation of China(No. LQ12F02011)Open Foundation of State Key Laboratory of Software Engineering of Wuhan University of China(No. SKLSE-2012-09-21)
文摘An intrinsic property of software in a real-world environment is its need to evolve, which is usually accompanied by the increase of software complexity and deterioration of software quality, making software maintenance a tough problem. Refactoring is regarded as an effective way to address this problem. Many refactoring approaches at the method and class level have been proposed. But the research on software refactoring at the package level is very little. This paper presents a novel approach to refactor the package structures of object oriented software. It uses software networks to represent classes and their dependencies. It proposes a constrained community detection algorithm to obtain the optimized community structures in software networks, which also correspond to the optimized package structures. And it finally provides a list of classes as refactoring candidates by comparing the optimized package structures with the real package structures. The empirical evaluation of the proposed approach has been performed in two open source Java projects, and the benefits of our approach are illustrated in comparison with the other three approaches.
文摘Software product line (SPL) is an approach used to develop a range of software products with a high degree of similarity. In this approach, a feature model is usually used to keep track of similarities and differences. Over time, as modifications are made to the SPL, inconsistencies with the feature model could arise. The first approach to dealing with these inconsistencies is refactoring. Refactoring consists of small steps which, when accumulated, may lead to large-scale changes in the SPL, resulting in features being added to or eliminated from the SPL. In this paper, we propose a framework for refactoring SPLs, which helps keep SPLs consistent with the feature model. After some introductory remarks, we describe a formal model for representing the feature model. We express various refactoring patterns applicable to the feature model and the SPL formally, and then introduce an algorithm for finding them in the SPL. In the end, we use a real-world case study of an SPL to illustrate the applicability of the framework introduced in the paper.
基金Project supported by the National Basic Research Program (973) of China (No. 2012CB315805), the National Natural Science Foundation of China (Nos. 61173167 and 61472130), the Prospective Research Project on Future Networks of Jiangsu Future Networks Innovation Institute, China (No. 2013095-1-05), the Hunan Provincial Innovation Foundation for Postgraduate, China (No. CX2014B150), and the State Scholarship Fund of China (No. 201406130048)
文摘Virtual routers are gaining increasing attention in the research field of future networks. As the core network device to achieve network virtualization, virtual routers have multiple virtual instances coexisting on a physical router platform, and each instance retains its own forwarding information base (FIB). Thus, memory scalability suffers from the limited on-chip memory. In this paper, we present a splitting-after-merging approach to compress the FIBs, which not only improves the memory efficiency but also offers an ideal split position to achieve system refactoring. Moreover, we propose an improved strategy to save the time used for system rebuilding to achieve fast refactoring. Experiments with 14 real-world routing data sets show that our approach needs only a unibit trie holding 134 188 nodes, while the original number of nodes is 4 569 133. Moreover, our approach has a good performance in scalability, guaranteeing 90 000 000 prefixes and 65 600 FIBs.
文摘Extract method is one of the most popular soft- ware refactorings. However, little work has been done to investigate or validate the major motivations for such refactorings. Digging into this issue might help researchers to improve tool support for extract method refactorings, e.g., proposing better tools to recommend refactoring opportunities, and to select fragments to be extracted. To this end, we conducted an interview with 25 developers, and our results suggest that current reuse, decomposition of long methods, clone resolution, and future reuse are the major motivations for extract method refactorings. We also validated the results by analyzing the refactoring history of seven open-source applications. Analysis results suggest that current reuse was the primary motivation for 56% of extract method refactorings, decomposition of methods was the primary motivation for 28% of extract method refactorings, and clone resolution was the primary motivation for 16% of extract method refactorings. These findings might suggest that recommending extract method opportunities by analyzing only the inner structure (e.g., complexity and length) of methods alone would miss many extract method opportunities. These findings also suggest that extract method refactorings are often driven by current and immediate reuse. Consequently, how to recognize or predict reuse requirements timely during software evolution may play a key role in the recommendation and automation of extract method refactorings. We also investigated the likelihood for the extracted methods to be reused in future, and our results suggest that such methods have a small chance (12%) to be reused in future unless the extracted fragment could be reused immediately in software evolution and extracting such a fragment can resolve existing clones at the same time.
文摘Model-Based Development has become an industry wide standard paradigm.As an open source alternative,Scilab/Xcos is being widely employed as a hybrid dynamic systems modeling tool.With the increasing efficiency in implementation using graphical model development and code generation,the modeling and simulation community is struggling with assuring quality as well as maintainability and extendibility.Refactoring is defined as an evolutionary modernization activity where,most of the time,the structure of the artifact is changed to alter its quality characteristics,while keeping its behavior unchanged.It has been widely established as a technique for textual programming languages to improve the code structure and quality.While refactoring is also regarded as one of the key practices of model engineering,the methodologies and approaches for model refactoring are still under development.Architecture-Driven Modernization(ADM)has been introduced by the software engineering community as a model-based approach to software modernization,in which the implicit information that lies in software artifacts is extracted to models and model transformations are applied for modernization tasks.Regarding refactoring as a low level modernization task,the practices from ADM are adaptable.Accordingly,this paper proposes a model-based approach for model refactoring in order to come up with more efficient and effective model refactoring methodology that is accessible and extendable by modelers.Like other graphical modeling tools,Scilab/Xcos also possesses a formalized model specification conforming to its implicit metamodel.Rather than proposing another metamodel for knowledge extraction,this pragmatic approach proposes to conduct in place model-to-model transformations for refactoring employing the Scilab/Xcos model specification.To construct a structured model-based approach,the implicit Scilab/Xcos metamodel is explicitly presented utilizing ECORE as a meta-metamodel.Then a practical model transformation approach is established based on Scilab scripting.A Scilab toolset is provided to the modeler for in-place model-to-model transformations.Using a sample case study,it is demonstrated that proposed model transformation functions in Scilab provide a valuable refactoring tool.
文摘Designing and optimizing complex scientific code for new computing architectures is a challenging task. To address this issue in the E3SM land model (ELM) development, we developed a software tool called SPEL, which facilitates code generation, verification, and performance tuning using compiler directives within a Function Unit Test framework. In this paper, we present a SPEL extension that leverages the version control system (e.g., Git) to autonomous code generation and demonstrate its application to continuous code integration and development of the ELM software system. The study can benefit the scientific software development community.
基金This work was supported by the National Natural Science Foundation(61363017)of China.The author is Liu,D.S.and the website is https://isisn.nsfc.gov.cn.
文摘Reusing code fragments by copying and pasting them with or without minor adaptation is a common activity in software development.As a result,software systems often contain sections of code that are very similar,called code clones.Code clones are beneficial in reducing software development costs and development risks.However,recent studies have indicated some negative impacts as a result.In order to effectively manage and utilize the clones,we design an approach for recommending refactoring clones based on a Bayesian network.Firstly,clone codes are detected from the source code.Secondly,the clones that need to be refactored are identified,and the static and evolutions features are extracted to build the feature database.Finally,the Bayesian network classifier is used for training and evaluating the classification results.Based on more than 640 refactor examples of five open source software developed in C,we observe a considerable enhancement.The results show that the accuracy of the approach is larger than 90%.We believe our approach will provide a more accurate and reasonable code refactoring and maintenance advice for software developers.
文摘Software modularization is a technique used to divide a software system into independent modules (packages)that are expected to be cohesive and loosely coupled. However, as software systems evolve over time to meet new require-ments, their modularizations become complex and gradually loose their quality. Thus, it is challenging to automaticallyoptimize the classes' distribution in packages, also known as remodularization. To alleviate this issue, we introduce a newapproach to optimize software modularization by moving classes to more suitable packages. In addition to improving designquality and preserving semantic coherence, our approach takes into consideration the refactoring effort as an objective initself while optimizing software modularization. We adapt the Elitist Non-dominated Sorting Genetic Algorithm (NSGA-Ⅱ)of Deb et al. to find the best sequence of refactorings that 1) maximize structural quality, 2) maximize semantic cohesivenessof packages (evaluated by a semantic measure based on WordNet), and 3) minimize the refactoring effort. We report theresults of an evaluation of our approach using open-source projects, and we show that our proposal is able to produce acoherent and useful sequence of recommended refactorings both in terms of quality metrics and from the developer's pointsof view.
基金Anhui Provincial Natural Science Foundation(2008085MF189,1908085MF206)National Natural Science Foundation of China(NO.61402007)the Scientific Research Foundation for the Returned Overseas Chinese Scholars,State Education Ministry.
文摘Code smell is the product of improper design and operation,which may be introduced in many situations.It will cause serious problems for further software development and maintenance.Currently,most code smell detection methods detect through a single type of software data.There are restrictions on detecting code smells with complex definitions and characteristics.In this paper,an approach of applying multi-dimensional software data is proposed.A complex network was built through structural data and historical version data,and code smell instances were determined by searching the network.We designed two smells detection strategies were designed and evaluated them in four open source projects.The results demonstrate that the proposed method has 23%and 15%higher F-measures on Shotgun Surgery and Parallel Inheritance Hierarchy than the existing mainstream detection ways.The code smell detection based on multi-dimensional software data and complex network is effective,and this method of processing multidimensional software data is also applicable for data-driven software research.
基金Project supported by the National Natural Science Foundation of China(Nos.61902181 and 62002161)the China Postdoctoral Science Foundation(No.2020M671489)+1 种基金the CCF-Tencent Open Research Fund(No.RAGR20200106)and the Nanjing University of Aeronautics and Astronautics Postgraduate Research and Practice Innovation Program(No.xcxjh20211612)。
文摘Methods in programs must be accurately named to facilitate source code analysis and comprehension.With the evolution of software,method names may be inconsistent with their implemented method bodies,leading to inaccurate or buggy method names.Debugging method names remains an important topic in the literature.Although researchers have proposed several approaches to suggest accurate method names once the method bodies have been modified,two main drawbacks remain to be solved:there is no analysis of method name structure,and the programming context information is not captured efficiently.To resolve these drawbacks and suggest more accurate method names,we propose a novel automated approach based on the analysis of the method name structure and lexical analysis with the programming context information.Our approach first leverages deep feature representation to embed method names and method bodies in vectors.Then,it obtains useful verb-tokens from a large method corpus through structural analysis and noun-tokens from method bodies through lexical analysis.Finally,our approach dynamically combines these tokens to form and recommend high-quality and project-specific method names.Experimental results over 2111 Java testing methods show that the proposed approach can achieve a Hit Ratio,or Hit@5,of 33.62%and outperform the state-of-the-art approach by 14.12%in suggesting accurate method names.We also demonstrate the effectiveness of structural and lexical analyses in our approach.