SlideShare a Scribd company logo
1 of 28
Download to read offline
The Use of Development History in Software
Refactoring Using a Multi-Objective
Evolutionary Algorithm
1DIRO, Université de Montréal, Canada
2CS, Missouri University of Science and Technology, USA
3IT Department, ABMMC, Qatar
Ali Ouni1,2, Marouane Kessentini2, Houari Sahraoui1,
and Mohamed Salah Hamdi3
Amsterdam, The Netherlands
July 06-10, 2013
2
Motivating example
Employee
ID
Name
FamilyName
Natinality
DateOfBirth
Sex
. . .
. . .
getPhoneNumber()
calculateLocalTax()
getAge()
calculateSalary()
setMaritalStatus()
getCurrentNatinality()
. . .
. . .
Car
IdNumber
TowingCapacity
OwnerName
. . .
getHistoryReport()
getTowingCapacity()
setInsuranceNum()
. . .
defect: Blob Position
PositionId
Grade
CompanyName
. . .
getPosition()
setGrade()
. . .
3
Outline
• Problem statement
• Approach : Multi-Objective Refactoring
• Evaluation
• Conclusion
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
4
• Design defect introduced during the initial
design or during evolution
– Anomalies, anti-patterns, bad smells…
– Design situations that adversely affect the development of a
software
– Examples: Blob, spagheti code, functional decomposition, ...
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Design defects
5
• Refactoring to correct them and to improve code
quality
– The process of improving a code after it has been written by
changing the internal structure of the code without changing the
external behavior (Fowler et al., ‘99)
– Examples: Move method, extract class, move attribute, ...
• Refactoring implementation may produce
semantic errors
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Refactoring
6
Problem statement
• Automate the refactoring task
• Existing approaches
– See the refactoring as a single-objective problem
– Improve the internal structure
– The semantics is not a major concern
– Produce semantic errors / incoherencies
– The consistency with development history is not
considered when searching for new refactorings
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
7
Problem statement
• Hypothesis
1. Code elements which undergo changes in the past, at
approximately the same time, bear a good probability for being
semantically related.
2. Code elements that experienced a huge number of refactoring
in the past have a good chance for refactoring in the future.
3. Recorded refactorings applied in the past can be used to
propose new ones in similar contexts.
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
8
Approach Overview
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Source code
with defects
Search-based Refactoring
(NSGA-II)
Defects detection
rules
Refactoring
operations
Proposed
refactorings
Software version archive
(change log, recorded refactorings …)
9
Multi-Objective Refactoring
• See the refactoring task as a multi-objective
optimization problem
– Improve software quality : defects correction
– Maximize the use of development/maintenance
history
– Preserve semantic coherence
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Meta Heuristic Search Using Multi-Objective
Optimization (NSGA-II)
10
NSGA-II overview
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
• NSGA-II: Non-dominated Sorting Genetic Algorithm (K. Deb et al., ’02)
Parent
Population
Offspring
Population
Non-dominated
sorting
F1
F2
F3
F4
Crowding distance
sorting
Population
in next
generation
11
NSGA-II adaptation
• Representation of the individuals
• Creation of a population of individuals
• Creation of new individuals using genetic operators
(crossover and mutation)
• Definition of fitness functions
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
12
– Individual = Refactoring solution (sequence of refactoring
operations)
– Controlling parameters
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Representation of individuals
MM PUF EC MF IC PDM
Ref Refactorings Controlling parameters
MM move method (sourceClass, targetClass, method)
MF move field (sourceClass, targetClass, field)
PUF pull up field (sourceClass, targetClass, field)
PUM pull up method (sourceClass, targetClass, method)
PDF push down field (sourceClass, targetClass, field)
PDM push down method (sourceClass, targetClass, method)
IC inline class (sourceClass, targetClass)
EC extract class (sourceClass, newClass)
13
– Population: set of refactoring solutions
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Population creation
MM PUF EC MF IC PDM . . .
MM PUF EC MF IC PDM . . .
MM PUF EC MF IC PDM . . .
MM PUF EC MF IC PDM . . .
MM PUF EC MF IC PDM MF PUM MM
MM PUF EC MF IC PDM MM
MM PUF EC MF IC PDM . . .
MM PUF EC MF IC PDM . . .
14
Genetic Operators
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Crossover
MM PUF EC MF IC PDM
MF IC PUM EC MM
K=3
Crossover
MM PUF EC EC MM
MF IC PUM MF IC PDM
Parent 1
Parent 2
Child 1
Child 2
MM PUF EC MF IC PDM
MutationParent Child
MM IC EC MM IC PDM
K=2, j=4
Mutation
15
Objective functions
1. Quality
- Maximize the number of corrected defects (ICPC’11)
2. Semantics
- Minimize semantic errors (ICSM’12)
3. Development/maintenance history reuse
– Maximize the use of past maintenance and development history to
find refactoring opportunities
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
16
Quality Objective Function
• For each candidate refactoring solution:
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
oringore_refactefects_befdetected_d#
defectscorrected_#
Quality
17
Semantics Objective Function
• Minimize semantic errors
– Vocabulary-based similarity (cosine similarity)
– Dependency-based similarity (shared method call, shared
fields)
• Intuition :
– The meaningfulness of proposed refectorings increase when
applied to semantically connected elements.
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
18
• Average of three measures
1. Score that characterizes the co-change of elements that will be
refactored.
2. Number of changes applied in the past to the same code
elements to modify
3. Similarity with good refactorings applied in the past to similar
code fragments
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
History-based Objective Function
19
Software version archive
1. Score that characterizes the co-change of elements that
will be refactored.
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
Commit 2
C
Commit 1
A
B
F
G
Commit 3
D
B
A
Commit 4
B
C
A
Commit 5
F
D
C
E
Changed files
Co-change
matrix (CCM)
Changed files
A B C D E F G
A 3 3 1 1 0 1 1
B 3 3 1 1 0 1 1
C 1 1 3 1 1 1 0
D 1 1 1 2 1 1 0
E 0 0 1 1 1 1 0
F 1 1 1 1 1 2 1
G 1 1 0 0 0 1 1
History-based Objective Function
20
2. Number of changes applied in the past to the same
code elements to modify
where t(e) is the number of times that the code element(s) e was refactored in the past and
n is the size of the list of possible refactoring operations.
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.


n
i
i etROmeasurehistory
1
)()(2_
History-based Objective Function
21
3. Similarity with previous refactorings applied to similar
code fragments
where n is the number of possible refactorings to use
m is the number of times that refactoring has been applied in the past
2 if the same refactoring has been applied in the past
w = 1 if a compatible refactoring has been applied in the past
0 otherwise
Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.


n
i
swROmeasurehistory
1
)(3_
History-based Objective Function
22
• Two research questions
– RQ1. To what extent the reuse of software development history
can improve the results of refactoring suggestion?
– RQ2. How do the proposed multi-objective approach performs
compared to random search, mono-objective approach and
other existing work ?
Evaluation
Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
23
Evaluation
• Data: Two large open source Java projects
Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
Systems # classes # defects KLOC
# revision
commits
Xerces v2.7.0 991 66 240 7493
JFreeChart v1.0.9
521 57 170 2009
24
Evaluation
• Method: Two metrics
– defect correction ratio (DCR)
– refactoring precision (RP)
Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
gsrefactorinapplyingbeforedefects#
defectscorrected#
DCR
gsrefactorinproposed#
gsrefactorinmeaningful#
RP
25
Results & Comparison
Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
Systems Approach Algorithm
Correction ratio
(DCR)
Meaningful
refactorings
(RP)
JFreeChart
v1.10.2
Our approach NSGA-II 86% (49|57) 94% (197|210)
Ouni et al. CSMR'13 NSGA-II 82% (47|57) 86% (202|234)
Harman et al. GECCO'07 Pareto opt. N.A 66% (192|289)
Kessentini et al. ICPC'11 GA 89% (51/57) 62% (147|236)
Ouni et al. ICSM'12 NSGA-II 84% (48/57) 77% (157|203)
Xerces-J
v2.7.0
Our approach NSGA-II 80% (53|66) 96% (282|294)
Ouni et al. CSMR'13 NSGA-II 79% (52|66) 93% (219|236)
Harman et al. GECCO'07 Pareto opt. N.A 63% (251|396)
Kessentini et al. ICPC'11 GA 88% (58/66) 69% (212|304)
Ouni et al. ICSM'12 NSGA-II 83% (55/66) 81% (186|228)
26
Results and comparison
Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
• Comparison
– NSGA-II
– GA (mono-objective)
– Random Search
0
10
20
30
40
50
60
70
80
90
100
JFreeChart Xerces
NSGA-II Mono-objective Random search
DCR
0
10
20
30
40
50
60
70
80
90
100
JFreeChart Xerces
NSGA-II Mono-objective Random search
RP
Defect correction ratio (DCR) Refactoring precision (RP)
27
Conclusion
• A novel search-based approach for refactoring suggestion
– The use of maintenance/development history in software refactoring
• Three objectives to optimize
– Quality
– Semantics preservation
– The use of development history
• Evaluation
– Two large open-source systems
– Our approach succeeded in correcting the majority of defects while
preserving the semantic coherence of the original program
• Future Work
– Use collected refactorings from different systems and calculates a similarity
with not only the refactoring type but also the context (code fragments)
– Test our approach with other other EA and other projects
Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
28
Thanks for your attention

More Related Content

What's hot

Software Defect Prediction on Unlabeled Datasets
Software Defect Prediction on Unlabeled DatasetsSoftware Defect Prediction on Unlabeled Datasets
Software Defect Prediction on Unlabeled DatasetsSung Kim
 
Cross-project defect prediction
Cross-project defect predictionCross-project defect prediction
Cross-project defect predictionThomas Zimmermann
 
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...Chakkrit (Kla) Tantithamthavorn
 
DeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning
DeepAM: Migrate APIs with Multi-modal Sequence to Sequence LearningDeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning
DeepAM: Migrate APIs with Multi-modal Sequence to Sequence LearningSung Kim
 
The adoption of machine learning techniques for software defect prediction: A...
The adoption of machine learning techniques for software defect prediction: A...The adoption of machine learning techniques for software defect prediction: A...
The adoption of machine learning techniques for software defect prediction: A...RAKESH RANA
 
Performance analysis of machine learning approaches in software complexity pr...
Performance analysis of machine learning approaches in software complexity pr...Performance analysis of machine learning approaches in software complexity pr...
Performance analysis of machine learning approaches in software complexity pr...Sayed Mohsin Reza
 
STAR: Stack Trace based Automatic Crash Reproduction
STAR: Stack Trace based Automatic Crash ReproductionSTAR: Stack Trace based Automatic Crash Reproduction
STAR: Stack Trace based Automatic Crash ReproductionSung Kim
 
An Empirical Study on the Adequacy of Testing in Open Source Projects
An Empirical Study on the Adequacy of Testing in Open Source ProjectsAn Empirical Study on the Adequacy of Testing in Open Source Projects
An Empirical Study on the Adequacy of Testing in Open Source ProjectsPavneet Singh Kochhar
 
Dissertation Defense
Dissertation DefenseDissertation Defense
Dissertation DefenseSung Kim
 
Deep API Learning (FSE 2016)
Deep API Learning (FSE 2016)Deep API Learning (FSE 2016)
Deep API Learning (FSE 2016)Sung Kim
 
A survey of fault prediction using machine learning algorithms
A survey of fault prediction using machine learning algorithmsA survey of fault prediction using machine learning algorithms
A survey of fault prediction using machine learning algorithmsAhmed Magdy Ezzeldin, MSc.
 
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)Sung Kim
 
Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...The University of Adelaide
 
Re2018 Semios for Requirements
Re2018 Semios for RequirementsRe2018 Semios for Requirements
Re2018 Semios for RequirementsClément Portet
 
Using Developer Information as a Prediction Factor
Using Developer Information as a Prediction FactorUsing Developer Information as a Prediction Factor
Using Developer Information as a Prediction FactorTim Menzies
 
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...Lionel Briand
 

What's hot (20)

Software Defect Prediction on Unlabeled Datasets
Software Defect Prediction on Unlabeled DatasetsSoftware Defect Prediction on Unlabeled Datasets
Software Defect Prediction on Unlabeled Datasets
 
Cross-project defect prediction
Cross-project defect predictionCross-project defect prediction
Cross-project defect prediction
 
Icsm20.ppt
Icsm20.pptIcsm20.ppt
Icsm20.ppt
 
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
Leveraging HPC Resources to Improve the Experimental Design of Software Analy...
 
DeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning
DeepAM: Migrate APIs with Multi-modal Sequence to Sequence LearningDeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning
DeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning
 
The adoption of machine learning techniques for software defect prediction: A...
The adoption of machine learning techniques for software defect prediction: A...The adoption of machine learning techniques for software defect prediction: A...
The adoption of machine learning techniques for software defect prediction: A...
 
Performance analysis of machine learning approaches in software complexity pr...
Performance analysis of machine learning approaches in software complexity pr...Performance analysis of machine learning approaches in software complexity pr...
Performance analysis of machine learning approaches in software complexity pr...
 
STAR: Stack Trace based Automatic Crash Reproduction
STAR: Stack Trace based Automatic Crash ReproductionSTAR: Stack Trace based Automatic Crash Reproduction
STAR: Stack Trace based Automatic Crash Reproduction
 
An Empirical Study on the Adequacy of Testing in Open Source Projects
An Empirical Study on the Adequacy of Testing in Open Source ProjectsAn Empirical Study on the Adequacy of Testing in Open Source Projects
An Empirical Study on the Adequacy of Testing in Open Source Projects
 
Dissertation Defense
Dissertation DefenseDissertation Defense
Dissertation Defense
 
Who Should Review My Code?
Who Should Review My Code?  Who Should Review My Code?
Who Should Review My Code?
 
Deep API Learning (FSE 2016)
Deep API Learning (FSE 2016)Deep API Learning (FSE 2016)
Deep API Learning (FSE 2016)
 
A survey of fault prediction using machine learning algorithms
A survey of fault prediction using machine learning algorithmsA survey of fault prediction using machine learning algorithms
A survey of fault prediction using machine learning algorithms
 
WCRE11b.ppt
WCRE11b.pptWCRE11b.ppt
WCRE11b.ppt
 
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
 
Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...Review Participation in Modern Code Review: An Empirical Study of the Android...
Review Participation in Modern Code Review: An Empirical Study of the Android...
 
Re2018 Semios for Requirements
Re2018 Semios for RequirementsRe2018 Semios for Requirements
Re2018 Semios for Requirements
 
ICSM12.ppt
ICSM12.pptICSM12.ppt
ICSM12.ppt
 
Using Developer Information as a Prediction Factor
Using Developer Information as a Prediction FactorUsing Developer Information as a Prediction Factor
Using Developer Information as a Prediction Factor
 
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
 

Similar to The Use of Development History in Software Refactoring Using a Multi-Objective Evolutionary Algorithm

CMPT470-usask-guest-lecture
CMPT470-usask-guest-lectureCMPT470-usask-guest-lecture
CMPT470-usask-guest-lectureMasud Rahman
 
Web Macros
Web MacrosWeb Macros
Web Macroscscaffid
 
Scalable constrained spectral clustering
Scalable constrained spectral clusteringScalable constrained spectral clustering
Scalable constrained spectral clusteringNishanth Harapanahalli
 
A Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug PredictionA Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug PredictionMartin Pinzger
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSnikshaikh786
 
TBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program RepairTBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program RepairDongsun Kim
 
Harnessing deep learning algorithms to predict software refactoring
Harnessing deep learning algorithms to predict software refactoringHarnessing deep learning algorithms to predict software refactoring
Harnessing deep learning algorithms to predict software refactoringTELKOMNIKA JOURNAL
 
Rishikesh Sharma Portfolio
Rishikesh Sharma PortfolioRishikesh Sharma Portfolio
Rishikesh Sharma Portfoliosharmarishikesh
 
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...Amine Barrak
 
Perf test Eng interview preparation
Perf test Eng interview preparationPerf test Eng interview preparation
Perf test Eng interview preparationpratik mohite
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...University of Hawai‘i at Mānoa
 
Summarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and TestingSummarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and TestingSebastiano Panichella
 
Implementation of reducing features to improve code change based bug predicti...
Implementation of reducing features to improve code change based bug predicti...Implementation of reducing features to improve code change based bug predicti...
Implementation of reducing features to improve code change based bug predicti...eSAT Journals
 
The Pill for Your Migration Hell
The Pill for Your Migration HellThe Pill for Your Migration Hell
The Pill for Your Migration HellDatabricks
 
Divya 3 yrs exp in qa engg
Divya 3 yrs exp in qa enggDivya 3 yrs exp in qa engg
Divya 3 yrs exp in qa enggDivya Lakshmi.B
 
Icse 2011 ds_1
Icse 2011 ds_1Icse 2011 ds_1
Icse 2011 ds_1SAIL_QU
 
How to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based WorldHow to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based WorldKen Owens
 

Similar to The Use of Development History in Software Refactoring Using a Multi-Objective Evolutionary Algorithm (20)

CMPT470-usask-guest-lecture
CMPT470-usask-guest-lectureCMPT470-usask-guest-lecture
CMPT470-usask-guest-lecture
 
Web Macros
Web MacrosWeb Macros
Web Macros
 
Scalable constrained spectral clustering
Scalable constrained spectral clusteringScalable constrained spectral clustering
Scalable constrained spectral clustering
 
A Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug PredictionA Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug Prediction
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUS
 
TBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program RepairTBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program Repair
 
Harnessing deep learning algorithms to predict software refactoring
Harnessing deep learning algorithms to predict software refactoringHarnessing deep learning algorithms to predict software refactoring
Harnessing deep learning algorithms to predict software refactoring
 
Mini Project- Dual Processor Computation
Mini Project- Dual Processor ComputationMini Project- Dual Processor Computation
Mini Project- Dual Processor Computation
 
BDS_QA.pdf
BDS_QA.pdfBDS_QA.pdf
BDS_QA.pdf
 
Rishikesh Sharma Portfolio
Rishikesh Sharma PortfolioRishikesh Sharma Portfolio
Rishikesh Sharma Portfolio
 
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media...
 
Perf test Eng interview preparation
Perf test Eng interview preparationPerf test Eng interview preparation
Perf test Eng interview preparation
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
 
Summarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and TestingSummarization Techniques for Code, Changes, and Testing
Summarization Techniques for Code, Changes, and Testing
 
Implementation of reducing features to improve code change based bug predicti...
Implementation of reducing features to improve code change based bug predicti...Implementation of reducing features to improve code change based bug predicti...
Implementation of reducing features to improve code change based bug predicti...
 
The Pill for Your Migration Hell
The Pill for Your Migration HellThe Pill for Your Migration Hell
The Pill for Your Migration Hell
 
Divya 3 yrs exp in qa engg
Divya 3 yrs exp in qa enggDivya 3 yrs exp in qa engg
Divya 3 yrs exp in qa engg
 
Icse 2011 ds_1
Icse 2011 ds_1Icse 2011 ds_1
Icse 2011 ds_1
 
How to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based WorldHow to Monitor Application Performance in a Container-Based World
How to Monitor Application Performance in a Container-Based World
 

Recently uploaded

Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 

Recently uploaded (20)

Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 

The Use of Development History in Software Refactoring Using a Multi-Objective Evolutionary Algorithm

  • 1. The Use of Development History in Software Refactoring Using a Multi-Objective Evolutionary Algorithm 1DIRO, Université de Montréal, Canada 2CS, Missouri University of Science and Technology, USA 3IT Department, ABMMC, Qatar Ali Ouni1,2, Marouane Kessentini2, Houari Sahraoui1, and Mohamed Salah Hamdi3 Amsterdam, The Netherlands July 06-10, 2013
  • 2. 2 Motivating example Employee ID Name FamilyName Natinality DateOfBirth Sex . . . . . . getPhoneNumber() calculateLocalTax() getAge() calculateSalary() setMaritalStatus() getCurrentNatinality() . . . . . . Car IdNumber TowingCapacity OwnerName . . . getHistoryReport() getTowingCapacity() setInsuranceNum() . . . defect: Blob Position PositionId Grade CompanyName . . . getPosition() setGrade() . . .
  • 3. 3 Outline • Problem statement • Approach : Multi-Objective Refactoring • Evaluation • Conclusion Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
  • 4. 4 • Design defect introduced during the initial design or during evolution – Anomalies, anti-patterns, bad smells… – Design situations that adversely affect the development of a software – Examples: Blob, spagheti code, functional decomposition, ... Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Design defects
  • 5. 5 • Refactoring to correct them and to improve code quality – The process of improving a code after it has been written by changing the internal structure of the code without changing the external behavior (Fowler et al., ‘99) – Examples: Move method, extract class, move attribute, ... • Refactoring implementation may produce semantic errors Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Refactoring
  • 6. 6 Problem statement • Automate the refactoring task • Existing approaches – See the refactoring as a single-objective problem – Improve the internal structure – The semantics is not a major concern – Produce semantic errors / incoherencies – The consistency with development history is not considered when searching for new refactorings Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
  • 7. 7 Problem statement • Hypothesis 1. Code elements which undergo changes in the past, at approximately the same time, bear a good probability for being semantically related. 2. Code elements that experienced a huge number of refactoring in the past have a good chance for refactoring in the future. 3. Recorded refactorings applied in the past can be used to propose new ones in similar contexts. Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
  • 8. 8 Approach Overview Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Source code with defects Search-based Refactoring (NSGA-II) Defects detection rules Refactoring operations Proposed refactorings Software version archive (change log, recorded refactorings …)
  • 9. 9 Multi-Objective Refactoring • See the refactoring task as a multi-objective optimization problem – Improve software quality : defects correction – Maximize the use of development/maintenance history – Preserve semantic coherence Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Meta Heuristic Search Using Multi-Objective Optimization (NSGA-II)
  • 10. 10 NSGA-II overview Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. • NSGA-II: Non-dominated Sorting Genetic Algorithm (K. Deb et al., ’02) Parent Population Offspring Population Non-dominated sorting F1 F2 F3 F4 Crowding distance sorting Population in next generation
  • 11. 11 NSGA-II adaptation • Representation of the individuals • Creation of a population of individuals • Creation of new individuals using genetic operators (crossover and mutation) • Definition of fitness functions Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
  • 12. 12 – Individual = Refactoring solution (sequence of refactoring operations) – Controlling parameters Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Representation of individuals MM PUF EC MF IC PDM Ref Refactorings Controlling parameters MM move method (sourceClass, targetClass, method) MF move field (sourceClass, targetClass, field) PUF pull up field (sourceClass, targetClass, field) PUM pull up method (sourceClass, targetClass, method) PDF push down field (sourceClass, targetClass, field) PDM push down method (sourceClass, targetClass, method) IC inline class (sourceClass, targetClass) EC extract class (sourceClass, newClass)
  • 13. 13 – Population: set of refactoring solutions Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Population creation MM PUF EC MF IC PDM . . . MM PUF EC MF IC PDM . . . MM PUF EC MF IC PDM . . . MM PUF EC MF IC PDM . . . MM PUF EC MF IC PDM MF PUM MM MM PUF EC MF IC PDM MM MM PUF EC MF IC PDM . . . MM PUF EC MF IC PDM . . .
  • 14. 14 Genetic Operators Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Crossover MM PUF EC MF IC PDM MF IC PUM EC MM K=3 Crossover MM PUF EC EC MM MF IC PUM MF IC PDM Parent 1 Parent 2 Child 1 Child 2 MM PUF EC MF IC PDM MutationParent Child MM IC EC MM IC PDM K=2, j=4 Mutation
  • 15. 15 Objective functions 1. Quality - Maximize the number of corrected defects (ICPC’11) 2. Semantics - Minimize semantic errors (ICSM’12) 3. Development/maintenance history reuse – Maximize the use of past maintenance and development history to find refactoring opportunities Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
  • 16. 16 Quality Objective Function • For each candidate refactoring solution: Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. oringore_refactefects_befdetected_d# defectscorrected_# Quality
  • 17. 17 Semantics Objective Function • Minimize semantic errors – Vocabulary-based similarity (cosine similarity) – Dependency-based similarity (shared method call, shared fields) • Intuition : – The meaningfulness of proposed refectorings increase when applied to semantically connected elements. Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.
  • 18. 18 • Average of three measures 1. Score that characterizes the co-change of elements that will be refactored. 2. Number of changes applied in the past to the same code elements to modify 3. Similarity with good refactorings applied in the past to similar code fragments Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. History-based Objective Function
  • 19. 19 Software version archive 1. Score that characterizes the co-change of elements that will be refactored. Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion. Commit 2 C Commit 1 A B F G Commit 3 D B A Commit 4 B C A Commit 5 F D C E Changed files Co-change matrix (CCM) Changed files A B C D E F G A 3 3 1 1 0 1 1 B 3 3 1 1 0 1 1 C 1 1 3 1 1 1 0 D 1 1 1 2 1 1 0 E 0 0 1 1 1 1 0 F 1 1 1 1 1 2 1 G 1 1 0 0 0 1 1 History-based Objective Function
  • 20. 20 2. Number of changes applied in the past to the same code elements to modify where t(e) is the number of times that the code element(s) e was refactored in the past and n is the size of the list of possible refactoring operations. Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.   n i i etROmeasurehistory 1 )()(2_ History-based Objective Function
  • 21. 21 3. Similarity with previous refactorings applied to similar code fragments where n is the number of possible refactorings to use m is the number of times that refactoring has been applied in the past 2 if the same refactoring has been applied in the past w = 1 if a compatible refactoring has been applied in the past 0 otherwise Context. Problem statement. Multi-Objective Refactoring. Validation. Conclusion.   n i swROmeasurehistory 1 )(3_ History-based Objective Function
  • 22. 22 • Two research questions – RQ1. To what extent the reuse of software development history can improve the results of refactoring suggestion? – RQ2. How do the proposed multi-objective approach performs compared to random search, mono-objective approach and other existing work ? Evaluation Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
  • 23. 23 Evaluation • Data: Two large open source Java projects Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion. Systems # classes # defects KLOC # revision commits Xerces v2.7.0 991 66 240 7493 JFreeChart v1.0.9 521 57 170 2009
  • 24. 24 Evaluation • Method: Two metrics – defect correction ratio (DCR) – refactoring precision (RP) Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion. gsrefactorinapplyingbeforedefects# defectscorrected# DCR gsrefactorinproposed# gsrefactorinmeaningful# RP
  • 25. 25 Results & Comparison Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion. Systems Approach Algorithm Correction ratio (DCR) Meaningful refactorings (RP) JFreeChart v1.10.2 Our approach NSGA-II 86% (49|57) 94% (197|210) Ouni et al. CSMR'13 NSGA-II 82% (47|57) 86% (202|234) Harman et al. GECCO'07 Pareto opt. N.A 66% (192|289) Kessentini et al. ICPC'11 GA 89% (51/57) 62% (147|236) Ouni et al. ICSM'12 NSGA-II 84% (48/57) 77% (157|203) Xerces-J v2.7.0 Our approach NSGA-II 80% (53|66) 96% (282|294) Ouni et al. CSMR'13 NSGA-II 79% (52|66) 93% (219|236) Harman et al. GECCO'07 Pareto opt. N.A 63% (251|396) Kessentini et al. ICPC'11 GA 88% (58/66) 69% (212|304) Ouni et al. ICSM'12 NSGA-II 83% (55/66) 81% (186|228)
  • 26. 26 Results and comparison Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion. • Comparison – NSGA-II – GA (mono-objective) – Random Search 0 10 20 30 40 50 60 70 80 90 100 JFreeChart Xerces NSGA-II Mono-objective Random search DCR 0 10 20 30 40 50 60 70 80 90 100 JFreeChart Xerces NSGA-II Mono-objective Random search RP Defect correction ratio (DCR) Refactoring precision (RP)
  • 27. 27 Conclusion • A novel search-based approach for refactoring suggestion – The use of maintenance/development history in software refactoring • Three objectives to optimize – Quality – Semantics preservation – The use of development history • Evaluation – Two large open-source systems – Our approach succeeded in correcting the majority of defects while preserving the semantic coherence of the original program • Future Work – Use collected refactorings from different systems and calculates a similarity with not only the refactoring type but also the context (code fragments) – Test our approach with other other EA and other projects Context. Problem statement. Multi-Objective. Refactoring. Validation. Conclusion.
  • 28. 28 Thanks for your attention