Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quaid-i-Azam University

Similar presentations


Presentation on theme: "Quaid-i-Azam University"— Presentation transcript:

1 Quaid-i-Azam University
Refactoring Patterns Study in Code Clones during Software Evolution Jaweria Kanwal Quaid-i-Azam University Islamabad, Pakistan Katsuro Inoue Osaka University Osaka, Japan Onaiza Maqbool Quaid-i-Azam University Islamabad, Pakistan

2 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] Clones need to be detected for better software maintenance 2 2

3 Clones refactoring Refactoring Fowler’s refactoring patterns [3]
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 3

4 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

5 Research questions How often code clones refactored in software?
How often clones refactored consistently? 5

6 Study Approach 6 JHotDraw Guava Jabref CloneMiner JFreeChart
Xerces_J CloneMiner a clone detection tool RefFinder Detection of refactorings from consecutive versions An application is developed in C# for mapping 6

7 How often code clones refactored in software?
7

8 Average clone refactorings in five Java systems
Versions JHotDraw Guava Jabref JFreeChart Xerces_J Vn 27. 4% 47.0% 6.0% 3.8% 32.0% 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% 17.0% 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 Average 24.2% 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 Actual refactorings are 496 in Vn+3 and only seven in next version 8

9 How often clones refactored consistently?
9

10 Refactoring consistency in Versions
Clone class Add_parameter Add_parameter I1 I1 I1 I1 Add_parameter I2 I2 I2 I2 Add_parameter I3 I3 I3 Add_parameter I3 I4 I4 Vn Vn+1 Vn Vn+1 (a) An example of consistent refactoring (b) An example of in- consistent refactoring 10

11 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% 47.1% Vn+3 52.0% 45.4% 70.4% 42.1% 49.0% Vn+4 66.8% 45.0% 32.3% 44.1% 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% 11

12 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

13 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 , 2005. M. Fowler, Refactoring: Improving the Design of Existing Programs. Addison-Wesley, 1999. 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 , 2009. Kamiya, Toshihiro and Kusumoto, Shinji and Inoue, Katsuro. CCFinder: a multilinguistic token-based code clone detection system for large scale source code, IEEE Transactions on Software Engineering, volume={28}, number={7}, Pp , 2002, IEEE. Aversano, Lerina and Cerulo, Luigi and Di Penta, Massimiliano. How clones are maintained: An empirical study,11th European Conference on Software Maintenance and Reengineering, pp , 2007, IEEE. Mens, Tom and Tourwe’, Tom. A survey of software refactoring, IEEE Transactions on software engineering, volume={30}, number={2}, Pp , 2004, IEEE. 13

14 ?


Download ppt "Quaid-i-Azam University"

Similar presentations


Ads by Google