Extracting local variable is a well-known and widely used refactoring technique designed to enhance code readability by replacing complex expressions with simpler variable references.Although most integrated developme...Extracting local variable is a well-known and widely used refactoring technique designed to enhance code readability by replacing complex expressions with simpler variable references.Although most integrated development environments(IDEs)provide tool support for such refactoring,these tools often result in semantic errors due to a lack of in-depth analysis.To overcome these limitations,we present ValExtractor,a novel and reliable approach for reliable automated variable extraction.The key challenge involves accurately and efficiently identifying the side effects of extracted expressions and their potential interactions with the surrounding context,without resorting to time-consuming dynamic execution.ValExtractor employs lightweight static source code analysis to validate the side effects of selected expressions and determine which instances of the expressions can be extracted together without altering program semantics or introducing new potential exceptions.Our evaluation demonstrates that mainstream refactoring engines,such as those in Eclipse and IntelliJ IDEA,frequently generate incorrect variable extractions,whereas ValExtractor successfully avoids these errors.The algorithm and its implementation have been integrated into Eclipse,serving over three million global Eclipse users.展开更多
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.展开更多
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.展开更多
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.展开更多
基金supported by the Postdoctoral Science Foundation of China under Grant Nos.2023M740078 and BX20240008.
文摘Extracting local variable is a well-known and widely used refactoring technique designed to enhance code readability by replacing complex expressions with simpler variable references.Although most integrated development environments(IDEs)provide tool support for such refactoring,these tools often result in semantic errors due to a lack of in-depth analysis.To overcome these limitations,we present ValExtractor,a novel and reliable approach for reliable automated variable extraction.The key challenge involves accurately and efficiently identifying the side effects of extracted expressions and their potential interactions with the surrounding context,without resorting to time-consuming dynamic execution.ValExtractor employs lightweight static source code analysis to validate the side effects of selected expressions and determine which instances of the expressions can be extracted together without altering program semantics or introducing new potential exceptions.Our evaluation demonstrates that mainstream refactoring engines,such as those in Eclipse and IntelliJ IDEA,frequently generate incorrect variable extractions,whereas ValExtractor successfully avoids these errors.The algorithm and its implementation have been integrated into Eclipse,serving over three million global Eclipse users.
文摘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.
文摘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.
基金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.