Code Clone Refactoring Study: Enhancing Software Evolution
Investigate how code clones impact software maintenance and explore the effectiveness of refactoring in improving code quality over different versions. The study delves into the frequency and consistency of code clone refactoring in various Java systems, shedding light on the evolution of software through refactoring practices.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Refactoring Patterns Study in Code Clones during Software Evolution Jaweria Kanwal Quaid-i-Azam University Islamabad, Pakistan Onaiza Maqbool Quaid-i-Azam University Islamabad, Pakistan onaiza@qau.edu.pk Katsuro Inoue Osaka University Osaka, Japan inoue@ist.osaka-u.ac.jp
Introduction Code Clones Similar code fragments in software Types of clones Type1, Type2, Type3 Sometimes clones cause an additional maintenance effort change in one clone fragment may cause change in other clone fragments [1] One of the maintenance tasks is to remove the clones from the system through refactoring [2] 2
Clones refactoring Refactoring Widely used technique to improve code quality Fowler s refactoring patterns [3] Some examples Move method Extract method Extract interface Add parameter Clone refactoring may/may not remove them from the system Add parameter Extract method 3
Motivation Existing work Study of changes behaviour of clones in versions [4] Consistent and inconsistent change Disappear in few check-ins All clones are not refactorable There is no work on the study of actual refactoring tasks performed on code clones 4
Research questions How often code clones refactored in software? How often clones refactored consistently? 5
Study Approach 1. 2. Guava 3. Jabref 4. JFreeChart 5. Xerces_J JHotDraw CloneMiner a clone detection tool RefFinder Detection of refactorings from consecutive versions An application is developed in C# for mapping 6
Research Question 1 How often code clones refactored in software? 7
Average clone refactorings in five Java systems Versions JHotDraw Guava Jabref JFreeChart Xerces_J Release time between version Vn+2 and Vn+3 is four months and release duration between version Vn+3 and Vn+4 is only one month 47.0% Vn 27. 4% 6.0% 3.8% 32.0% Actual refactorings are 496 in Vn+3 and only seven in next version Vn+1 19.1% 0.8% 9.0% 4.5% 24.8% Vn+2 21.1% 0.5% 4.8% 1.3% 34.0% Vn+3 21.4% 0.8% 17.0% 0.5% 34.2% Vn+4 33.3% 6.2% 6.7% 1.2% 2.0% Vn+5 8.2% 0.4% 0.6% 10.5% Vn+6 3.4% 7.1% Vn+7 8.2% Average 24.2% 10.5% 6.7% 2.0% 19.1% 8
Research Question 2 How often clones refactored consistently? 9
Refactoring consistency in Versions Clone class Add_parameter Add_parameter I1 I1 I1 I1 I2 I2 Add_parameter I2 I2 Add_parameter I3 I4 I3 Add_parameter I3 I3 I4 Vn Vn+1 Vn Vn+1 (a) An example of consistent refactoring (b) An example of in- consistent refactoring 10
Percentage of consistent refactoring in five Java systems Versions JHotDraw Guava Jabref JFreeChart Xerces_J Vn 62.7% 62.0% 50.0% 32.0% 53.1% Vn+1 56.7% 20.0% 80.0% 42.0% 40.0% Vn+2 73.5% 100% 42.8% 32.0% 47.1% Vn+3 52.0% 45.4% 70.4% 42.1% 49.0% Vn+4 66.8% 45.0% 32.3% 44.1% 100% Vn+5 48.0% 10.0% 36.0% 34.2% Vn+6 45.1% 44.4% Vn+7 52.3% Average 62.2% 53.2% 47.2% 38.0% 52.0% 11
Conclusions and Future work A small portion of code clones are refactored Clone refactoring depends upon actual refactoring tasks performed during the releases Consistent refactorings More than 40% clones are refactored consistently in most of the versions Future work Consequences of inconsistent clone refactorings on software maintenance 12
References M. Kim, V. Sazawal, D. Notkin, and G. Murphy. An Empirical Study of Code Clone Genealogies. ACM SIGSOFT Software Engineering Notes, 30(5), pp. 187- 196, 2005. 2. M. Fowler, Refactoring: Improving the Design of Existing Programs. Addison-Wesley, 1999. 3. H. Basit, and S. Jarzabek. A data mining approach for detecting higher-level clones in software. In journal of IEEE Transactions on Software Engineering, 35(4), pp. 497-514, 2009. 4. Kamiya, Toshihiro and Kusumoto, Shinji and Inoue, Katsuro. CCFinder: a multilinguistic token-based code clone detection system for large scale source 1. 13
Thanks! ?