There are lots of code clones appearing in software,which are similar code fragments with each other. In the past decades,researchers have proposed some state-of-the-art methods to detect clones. The code clones have ...There are lots of code clones appearing in software,which are similar code fragments with each other. In the past decades,researchers have proposed some state-of-the-art methods to detect clones. The code clones have showing some relationship with the evolution of software. In order to explore relationships between clones and their evolution,we propose a framework to cluster clones with a Fuzzy C-means clustering method.Firstly,we detect all the clones using Ni Cad,and build the clone genealogies for multiple versions software.Secondly,we extract some metrics to describe the clones and their evolution. Finally,we cluster all clone's vectors,which are generated with the different metrics for different proposes. Experimental results on six open source software packages have shown the relationships among the clone life,the number of change times,the clone pattern and et al. can help developers to understand clones.展开更多
In the recent era of software development,reusing software is one of the major activities that is widely used to save time.To reuse software,the copy and paste method is used and this whole process is known as code cl...In the recent era of software development,reusing software is one of the major activities that is widely used to save time.To reuse software,the copy and paste method is used and this whole process is known as code cloning.This activity leads to problems like difficulty in debugging,increase in time to debug and manage software code.In the literature,various algorithms have been developed to find out the clones but it takes too much time as well as more space to figure out the clones.Unfortunately,most of them are not scalable.This problem has been targeted upon in this paper.In the proposed framework,authors have proposed a new method of identifying clones that takes lesser time to find out clones as compared with many popular code clone detection algorithms.The proposed framework has also addressed one of the key issues in code clone detection i.e.,detection of near-miss(Type-3)and semantic clones(Type-4)with significant accuracy of 95.52%and 92.80%respectively.The present study is divided into two phases,the first method converts any code into an intermediate representation form i.e.,Hashinspired abstract syntax trees.In the second phase,these abstract syntax trees are passed to a novel approach“Similarity-based self-adjusting hash inspired abstract syntax tree”algorithm that helps in knowing the similarity level of codes.The proposed method has shown a lot of improvement over the existing code clones identification methods.展开更多
This article proposes the high-speed and high-accuracy code clone detection method based on the combination of tree-based and token-based methods. Existence of duplicated program codes, called code clone, is one of th...This article proposes the high-speed and high-accuracy code clone detection method based on the combination of tree-based and token-based methods. Existence of duplicated program codes, called code clone, is one of the main factors that reduces the quality and maintainability of software. If one code fragment contains faults (bugs) and they are copied and modified to other locations, it is necessary to correct all of them. But it is not easy to find all code clones in large and complex software. Much research efforts have been done for code clone detection. There are mainly two methods for code clone detection. One is token-based and the other is tree-based method. Token-based method is fast and requires less resources. However it cannot detect all kinds of code clones. Tree-based method can detect all kinds of code clones, but it is slow and requires much computing resources. In this paper combination of these two methods was proposed to improve the efficiency and accuracy of detecting code clones. Firstly some candidates of code clones will be extracted by token-based method that is fast and lightweight. Then selected candidates will be checked more precisely by using tree-based method that can find all kinds of code clones. The prototype system was developed. This system accepts source code and tokenizes it in the first step. Then token-based method is applied to this token sequence to find candidates of code clones. After extracting several candidates, selected source codes will be converted into abstract syntax tree (AST) for applying tree-based method. Some sample source codes were used to evaluate the proposed method. This evaluation proved the improvement of efficiency and precision of code clones detecting.展开更多
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.展开更多
基金Sponsored by the National Natural Science Foundation of China(Grant No.61173021)
文摘There are lots of code clones appearing in software,which are similar code fragments with each other. In the past decades,researchers have proposed some state-of-the-art methods to detect clones. The code clones have showing some relationship with the evolution of software. In order to explore relationships between clones and their evolution,we propose a framework to cluster clones with a Fuzzy C-means clustering method.Firstly,we detect all the clones using Ni Cad,and build the clone genealogies for multiple versions software.Secondly,we extract some metrics to describe the clones and their evolution. Finally,we cluster all clone's vectors,which are generated with the different metrics for different proposes. Experimental results on six open source software packages have shown the relationships among the clone life,the number of change times,the clone pattern and et al. can help developers to understand clones.
文摘In the recent era of software development,reusing software is one of the major activities that is widely used to save time.To reuse software,the copy and paste method is used and this whole process is known as code cloning.This activity leads to problems like difficulty in debugging,increase in time to debug and manage software code.In the literature,various algorithms have been developed to find out the clones but it takes too much time as well as more space to figure out the clones.Unfortunately,most of them are not scalable.This problem has been targeted upon in this paper.In the proposed framework,authors have proposed a new method of identifying clones that takes lesser time to find out clones as compared with many popular code clone detection algorithms.The proposed framework has also addressed one of the key issues in code clone detection i.e.,detection of near-miss(Type-3)and semantic clones(Type-4)with significant accuracy of 95.52%and 92.80%respectively.The present study is divided into two phases,the first method converts any code into an intermediate representation form i.e.,Hashinspired abstract syntax trees.In the second phase,these abstract syntax trees are passed to a novel approach“Similarity-based self-adjusting hash inspired abstract syntax tree”algorithm that helps in knowing the similarity level of codes.The proposed method has shown a lot of improvement over the existing code clones identification methods.
文摘This article proposes the high-speed and high-accuracy code clone detection method based on the combination of tree-based and token-based methods. Existence of duplicated program codes, called code clone, is one of the main factors that reduces the quality and maintainability of software. If one code fragment contains faults (bugs) and they are copied and modified to other locations, it is necessary to correct all of them. But it is not easy to find all code clones in large and complex software. Much research efforts have been done for code clone detection. There are mainly two methods for code clone detection. One is token-based and the other is tree-based method. Token-based method is fast and requires less resources. However it cannot detect all kinds of code clones. Tree-based method can detect all kinds of code clones, but it is slow and requires much computing resources. In this paper combination of these two methods was proposed to improve the efficiency and accuracy of detecting code clones. Firstly some candidates of code clones will be extracted by token-based method that is fast and lightweight. Then selected candidates will be checked more precisely by using tree-based method that can find all kinds of code clones. The prototype system was developed. This system accepts source code and tokenizes it in the first step. Then token-based method is applied to this token sequence to find candidates of code clones. After extracting several candidates, selected source codes will be converted into abstract syntax tree (AST) for applying tree-based method. Some sample source codes were used to evaluate the proposed method. This evaluation proved the improvement of efficiency and precision of code clones detecting.
基金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.