SlideShare a Scribd company logo
Proactive Clone Recommendation System
for Extract Method Refactoring
Eunjong
Choi
Norihiro
Yoshida
Katsuro
Inoue
Seiya
Numata
1
Code clone (duplicated code)
Developers tend to write clones unintentionally
even in the case that it is easily avoidable.
File A File B
Code Clone
copy and paste
copy and paste
2
Clone Refactoring
It performs “Extract Method”
and then merges clones into a single method.
Before After
callRefactoring
3
Developers are motivated to refactor clones!
[Alomar et al., IWoR 2019]
4
Related Works:
Tool Support for Clone Refactoring
• Tairas and Gray [IST ‘12]
• extension of refactoring engines to handle variation of clones
• Meng et al. [ICSE ‘15]
• clone refactoring tool based on systematic edit
• Mazinanian et al. [ICSE ‘16]
• a part of the refactoring tool JDeodorant
• refactorability analysis [TSE ‘15]
5
Strike while the iron is hot!
• Only hot clones are refactored in industry
• In industry, cost of clone refactoring cannot be ignored.
• Regression test after refactoring takes much cost.
• Industrial developers do not touch source code
after a large-scale system test for releasing a major version.
Active support of clone refactoring is needed.
6
Proposed Plug-in
It detects ‘Extract Method’ on the fly
and then recommend the corresponding clones.
7
Monitors code modification on the fly
and detects ‘Extract Method’
Recommends developers to merge
the other corresponding clones at same time
Phase1: Monitor & Detection Phase2: Clone Recommendation
Extract
Methodclone
clone new m.
clone
Online
analysis
clone
clone new m.
clone
recommends
Architecture of the proposed plug-in
8
developer
Editor
AST-level diff
Clone
detection
(CCFinderX)
Keystroke
monitoring
Diff
analysis
Clone
recommendation
Refactoring
detection
Clones of
refactored code
Clone
detection
result
Refactoring
detection
result
Keystroke and diff analyses
1. Identifies the insertion/deletion of one or greater lines.
2. Keeps AST-based diff once the insertion/deletion is identified
Insertion of
a method
declaration
Deletion of
a code block
…
9
Detection of “Extract Method” Refactoring
𝐼𝑛𝑠𝑒𝑟𝑡, 𝑀𝑒𝑡ℎ𝑜𝑑𝐷𝑒𝑐𝑙𝑎𝑟𝑎𝑡𝑖𝑜𝑛
∧
Delete, 𝑐𝑜𝑑𝑒__𝑏𝑙𝑜𝑐𝑘
∧
𝐼𝑛𝑠𝑒𝑟𝑡, 𝑀𝑒𝑡ℎ𝑜𝑑𝐼𝑛𝑣𝑜𝑐𝑎𝑡𝑖𝑜𝑛
𝑤ℎ𝑒𝑟𝑒
𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑐𝑜𝑑𝑒__𝑏𝑙𝑜𝑐𝑘 = 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑀𝑒𝑡ℎ𝑜𝑑𝐼𝑛𝑣𝑜𝑐𝑎𝑡𝑖𝑜𝑛
∧ 𝑛𝑎𝑚𝑒 𝑀𝑒𝑡ℎ𝑜𝑑𝐷𝑒𝑐𝑙𝑎𝑟𝑎𝑡𝑖𝑜𝑛 = 𝑛𝑎𝑚𝑒(𝑀𝑒𝑡ℎ𝑜𝑑𝐼𝑛𝑣𝑜𝑐𝑎𝑡𝑖𝑜𝑛)
Insertion of method
declaration
Block deletion
Insertion of method
invocation
Block and the method invocation are at the same position.
Declared and invoked methods are the same names.
10
Clone detection & recommendation
• Clone Detection
• Performs clone detection when a method
declaration is inserted in Eclipse AST
• Uses CCFinderX
High-speed token-based clone detection tool
• Clone Recommendation
• Recommend code clones of the code fragment
which is extracted by ”Extract Method” refactoring
recommends
clone
clone new m.
clone
clone
clone
clone
11
12
Start the monitoring of clone refactoring by
selecting “monitoring refactoring” menu
Java editor of Eclipse
List of recommend clones
A pair of
code clones
13
Extract Method
Detects clones of the code which is
extracted by “Extract Method”
14
A list of modified files A list of code clones in
the modified file
A list of code clones
in the other file
A list of all files
Clone set ID Clone set info. Line numbers
15
Highlighted code clone
Summary & Future work
• We proposed a proactive clone recommendation system
for extract method refactoring.
• monitors code modification on the fly and detects ‘Extract Method’
• recommends developers to merge the corresponding clone to the
new method
• We plan to apply other “Extract Method” detection technique
and then perform a large-scale user study.
16

More Related Content

Similar to Proactive Clone Recommendation System for Extract Method Refactoring

Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
Exception
ExceptionException
Exception
abhay singh
 
Exception handling in .net
Exception handling in .netException handling in .net
PROGRAMMING IN JAVA
PROGRAMMING IN JAVAPROGRAMMING IN JAVA
PROGRAMMING IN JAVA
SivaSankari36
 
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
acijjournal
 
OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)
SURBHI SAROHA
 
exception handling in java.ppt
exception handling in java.pptexception handling in java.ppt
exception handling in java.ppt
Varshini62
 
43c
43c43c
Lecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptxLecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptx
VishuSaini22
 
Core java
Core javaCore java
Core java
Shivaraj R
 
Core java
Core javaCore java
Core java
Sun Technlogies
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
Lilia Sfaxi
 
Principles and patterns for test driven development
Principles and patterns for test driven developmentPrinciples and patterns for test driven development
Principles and patterns for test driven development
Stephen Fuqua
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
CocoaHeads France
 
Exception handling in java
Exception handling  in javaException handling  in java
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
TO THE NEW | Technology
 
Lecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptxLecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptx
sunilsoni446112
 
Eclipse Tips & Tricks - EclipseCon North America 2014
Eclipse Tips & Tricks - EclipseCon North America 2014Eclipse Tips & Tricks - EclipseCon North America 2014
Eclipse Tips & Tricks - EclipseCon North America 2014
Noopur Gupta
 
Empirical Results on Cloning and Clone Detection
Empirical Results on Cloning and Clone DetectionEmpirical Results on Cloning and Clone Detection
Empirical Results on Cloning and Clone Detection
Förderverein Technische Fakultät
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
Sergey Podolsky
 

Similar to Proactive Clone Recommendation System for Extract Method Refactoring (20)

Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
 
Exception
ExceptionException
Exception
 
Exception handling in .net
Exception handling in .netException handling in .net
Exception handling in .net
 
PROGRAMMING IN JAVA
PROGRAMMING IN JAVAPROGRAMMING IN JAVA
PROGRAMMING IN JAVA
 
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
 
OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)
 
exception handling in java.ppt
exception handling in java.pptexception handling in java.ppt
exception handling in java.ppt
 
43c
43c43c
43c
 
Lecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptxLecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptx
 
Core java
Core javaCore java
Core java
 
Core java
Core javaCore java
Core java
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Principles and patterns for test driven development
Principles and patterns for test driven developmentPrinciples and patterns for test driven development
Principles and patterns for test driven development
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
Exception handling in java
Exception handling  in javaException handling  in java
Exception handling in java
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
 
Lecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptxLecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptx
 
Eclipse Tips & Tricks - EclipseCon North America 2014
Eclipse Tips & Tricks - EclipseCon North America 2014Eclipse Tips & Tricks - EclipseCon North America 2014
Eclipse Tips & Tricks - EclipseCon North America 2014
 
Empirical Results on Cloning and Clone Detection
Empirical Results on Cloning and Clone DetectionEmpirical Results on Cloning and Clone Detection
Empirical Results on Cloning and Clone Detection
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 

More from Norihiro Yoshida

ファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試み
ファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試みファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試み
ファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試み
Norihiro Yoshida
 
Extracting a Micro State Transition Table Using KLEE
Extracting a Micro State Transition Table Using KLEEExtracting a Micro State Transition Table Using KLEE
Extracting a Micro State Transition Table Using KLEE
Norihiro Yoshida
 
A Quantitative Comparison of Coverage-Based Greybox Fuzzers
A Quantitative Comparison of Coverage-Based Greybox FuzzersA Quantitative Comparison of Coverage-Based Greybox Fuzzers
A Quantitative Comparison of Coverage-Based Greybox Fuzzers
Norihiro Yoshida
 
ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料
Norihiro Yoshida
 
コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発
Norihiro Yoshida
 
Code Search Based on Deep Neural Network and Code Mutation
Code Search Based on Deep Neural Network and Code MutationCode Search Based on Deep Neural Network and Code Mutation
Code Search Based on Deep Neural Network and Code Mutation
Norihiro Yoshida
 
機械学習システムにおける技術的負債について
機械学習システムにおける技術的負債について機械学習システムにおける技術的負債について
機械学習システムにおける技術的負債について
Norihiro Yoshida
 
When, why and for whom do practitioners detect technical debts?: An experienc...
When, why and for whom do practitioners detect technical debts?: An experienc...When, why and for whom do practitioners detect technical debts?: An experienc...
When, why and for whom do practitioners detect technical debts?: An experienc...
Norihiro Yoshida
 
Revisiting the Relationship Between Code Smells and Refactoring
Revisiting the Relationship Between Code Smells and RefactoringRevisiting the Relationship Between Code Smells and Refactoring
Revisiting the Relationship Between Code Smells and Refactoring
Norihiro Yoshida
 
Mining the Modern Code Review Repositories: A Dataset of People, Process and ...
Mining the Modern Code Review Repositories: A Dataset of People, Process and ...Mining the Modern Code Review Repositories: A Dataset of People, Process and ...
Mining the Modern Code Review Repositories: A Dataset of People, Process and ...
Norihiro Yoshida
 
IWESEP 2013
IWESEP 2013IWESEP 2013
IWESEP 2013
Norihiro Yoshida
 
MSR2013
MSR2013MSR2013

More from Norihiro Yoshida (12)

ファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試み
ファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試みファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試み
ファジングツールAFLの利用を支援するツールFuzz4Bによるファジング教育の試み
 
Extracting a Micro State Transition Table Using KLEE
Extracting a Micro State Transition Table Using KLEEExtracting a Micro State Transition Table Using KLEE
Extracting a Micro State Transition Table Using KLEE
 
A Quantitative Comparison of Coverage-Based Greybox Fuzzers
A Quantitative Comparison of Coverage-Based Greybox FuzzersA Quantitative Comparison of Coverage-Based Greybox Fuzzers
A Quantitative Comparison of Coverage-Based Greybox Fuzzers
 
ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料
 
コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発
 
Code Search Based on Deep Neural Network and Code Mutation
Code Search Based on Deep Neural Network and Code MutationCode Search Based on Deep Neural Network and Code Mutation
Code Search Based on Deep Neural Network and Code Mutation
 
機械学習システムにおける技術的負債について
機械学習システムにおける技術的負債について機械学習システムにおける技術的負債について
機械学習システムにおける技術的負債について
 
When, why and for whom do practitioners detect technical debts?: An experienc...
When, why and for whom do practitioners detect technical debts?: An experienc...When, why and for whom do practitioners detect technical debts?: An experienc...
When, why and for whom do practitioners detect technical debts?: An experienc...
 
Revisiting the Relationship Between Code Smells and Refactoring
Revisiting the Relationship Between Code Smells and RefactoringRevisiting the Relationship Between Code Smells and Refactoring
Revisiting the Relationship Between Code Smells and Refactoring
 
Mining the Modern Code Review Repositories: A Dataset of People, Process and ...
Mining the Modern Code Review Repositories: A Dataset of People, Process and ...Mining the Modern Code Review Repositories: A Dataset of People, Process and ...
Mining the Modern Code Review Repositories: A Dataset of People, Process and ...
 
IWESEP 2013
IWESEP 2013IWESEP 2013
IWESEP 2013
 
MSR2013
MSR2013MSR2013
MSR2013
 

Recently uploaded

New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
This is my Environmental physics presentation
This is my Environmental physics presentationThis is my Environmental physics presentation
This is my Environmental physics presentation
ZainabHashmi17
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 

Recently uploaded (20)

New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
This is my Environmental physics presentation
This is my Environmental physics presentationThis is my Environmental physics presentation
This is my Environmental physics presentation
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 

Proactive Clone Recommendation System for Extract Method Refactoring

  • 1. Proactive Clone Recommendation System for Extract Method Refactoring Eunjong Choi Norihiro Yoshida Katsuro Inoue Seiya Numata 1
  • 2. Code clone (duplicated code) Developers tend to write clones unintentionally even in the case that it is easily avoidable. File A File B Code Clone copy and paste copy and paste 2
  • 3. Clone Refactoring It performs “Extract Method” and then merges clones into a single method. Before After callRefactoring 3
  • 4. Developers are motivated to refactor clones! [Alomar et al., IWoR 2019] 4
  • 5. Related Works: Tool Support for Clone Refactoring • Tairas and Gray [IST ‘12] • extension of refactoring engines to handle variation of clones • Meng et al. [ICSE ‘15] • clone refactoring tool based on systematic edit • Mazinanian et al. [ICSE ‘16] • a part of the refactoring tool JDeodorant • refactorability analysis [TSE ‘15] 5
  • 6. Strike while the iron is hot! • Only hot clones are refactored in industry • In industry, cost of clone refactoring cannot be ignored. • Regression test after refactoring takes much cost. • Industrial developers do not touch source code after a large-scale system test for releasing a major version. Active support of clone refactoring is needed. 6
  • 7. Proposed Plug-in It detects ‘Extract Method’ on the fly and then recommend the corresponding clones. 7 Monitors code modification on the fly and detects ‘Extract Method’ Recommends developers to merge the other corresponding clones at same time Phase1: Monitor & Detection Phase2: Clone Recommendation Extract Methodclone clone new m. clone Online analysis clone clone new m. clone recommends
  • 8. Architecture of the proposed plug-in 8 developer Editor AST-level diff Clone detection (CCFinderX) Keystroke monitoring Diff analysis Clone recommendation Refactoring detection Clones of refactored code Clone detection result Refactoring detection result
  • 9. Keystroke and diff analyses 1. Identifies the insertion/deletion of one or greater lines. 2. Keeps AST-based diff once the insertion/deletion is identified Insertion of a method declaration Deletion of a code block … 9
  • 10. Detection of “Extract Method” Refactoring 𝐼𝑛𝑠𝑒𝑟𝑡, 𝑀𝑒𝑡ℎ𝑜𝑑𝐷𝑒𝑐𝑙𝑎𝑟𝑎𝑡𝑖𝑜𝑛 ∧ Delete, 𝑐𝑜𝑑𝑒__𝑏𝑙𝑜𝑐𝑘 ∧ 𝐼𝑛𝑠𝑒𝑟𝑡, 𝑀𝑒𝑡ℎ𝑜𝑑𝐼𝑛𝑣𝑜𝑐𝑎𝑡𝑖𝑜𝑛 𝑤ℎ𝑒𝑟𝑒 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑐𝑜𝑑𝑒__𝑏𝑙𝑜𝑐𝑘 = 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑀𝑒𝑡ℎ𝑜𝑑𝐼𝑛𝑣𝑜𝑐𝑎𝑡𝑖𝑜𝑛 ∧ 𝑛𝑎𝑚𝑒 𝑀𝑒𝑡ℎ𝑜𝑑𝐷𝑒𝑐𝑙𝑎𝑟𝑎𝑡𝑖𝑜𝑛 = 𝑛𝑎𝑚𝑒(𝑀𝑒𝑡ℎ𝑜𝑑𝐼𝑛𝑣𝑜𝑐𝑎𝑡𝑖𝑜𝑛) Insertion of method declaration Block deletion Insertion of method invocation Block and the method invocation are at the same position. Declared and invoked methods are the same names. 10
  • 11. Clone detection & recommendation • Clone Detection • Performs clone detection when a method declaration is inserted in Eclipse AST • Uses CCFinderX High-speed token-based clone detection tool • Clone Recommendation • Recommend code clones of the code fragment which is extracted by ”Extract Method” refactoring recommends clone clone new m. clone clone clone clone 11
  • 12. 12 Start the monitoring of clone refactoring by selecting “monitoring refactoring” menu Java editor of Eclipse List of recommend clones A pair of code clones
  • 13. 13 Extract Method Detects clones of the code which is extracted by “Extract Method”
  • 14. 14 A list of modified files A list of code clones in the modified file A list of code clones in the other file A list of all files Clone set ID Clone set info. Line numbers
  • 16. Summary & Future work • We proposed a proactive clone recommendation system for extract method refactoring. • monitors code modification on the fly and detects ‘Extract Method’ • recommends developers to merge the corresponding clone to the new method • We plan to apply other “Extract Method” detection technique and then perform a large-scale user study. 16

Editor's Notes

  1. そこで,その問題点を解決するために,Eclipseプラグインにより以下の環境を提案します.提案環境は大きく分けて2つの機能を有しており,1つ目の機能では,Eclipseを利用している開発者の作業内容をモニタリングし,その中からメソッド抽出リファクタリングの集約パターンを見つけます.そして,2つ目の機能では,そのメソッド抽出リファクタリングが行われたコード片のコードクローンを検出し,同時に集約するように推薦します.これにより,開発者はIDEと切り離した作業が必要なく,開発の際中に同時集約候補を知ることができ,見落としなく,少ないコストでメソッド抽出リファクタリングを行えると考えます.(3:00)
  2. ここからそれぞれのステップについて説明します.まずはステップ1のキー入力追跡です.(5:04)
  3. Here is the formula of the conditions of Extract method refactoring used in this study. There are five conditions in this formula, The first one is the insertion of method declaration. The second one is block deletion. The third one is the insertion of method invocation, The forth one is the block and the method invocation are at same position. The declared and invoked method are same name. When the all of 5 conditions are satisfied, the proposed plugin regards the code modification as ”Extract Method” refactoring.
  4. Here is the screenshot of the proposed plugin. An user starts the monitoring of clone refactoring by selecting “by the monitoring refactoring menu. The view on the right-hand side shows the list of recommend clones based on the analysis of code modification in the Java editor of Eclipse. The Java editor on the left-hand side includes a pair clones.
  5. Here we assume a user performs “Extract Method” refactoring as you can see in the left-hand side on the slide. Then, the proposed plug-in detects clones of the code fragment is extracted by “Extract Method”refactoring as you can see on the right-hand side of the slide.
  6. At the same time, the list of recommend clones is shown in the right-hand side of the result view. Once a user selects one of them …
  7. The recommend clone is highlighted in the Java Editor of Eclipse.