Assessing Single-Objective Performance Assessing Single-Objective Performance Convergence and Time Complexity for Convergence and Time Complexity for Refactoring Detection Refactoring Detection by D. Nader-Palacio, D. Rodriguez -Cardenas , J. Gomez Universidad Nacional de Colombia & Universidad del Rosario Research Group on Artificial Life (Alife) GECCO 2018 Kyoto
Terminology Terminology
[Software Refactoring] consists of re-constructing the code design of a [Software Refactoring] consists of re-constructing the code design of a software system without affecting the software system without affecting the behavior functionality behavior functionality (Fowler & (Fowler & Beck, 1999) Beck, 1999)
[Refactoring & Reconstruction] Refactoring is a subset of [Refactoring & Reconstruction] Refactoring is a subset of Reconstructions Reconstructions (Mens & Tourwe, 2004) (Mens & Tourwe, 2004)
The refactoring process is still an issue (ACM October 2017) The refactoring process is still an issue (ACM October 2017)
State-of-the-art State-of-the-art
The authors propose informal optimization models for the Refactoring The authors propose informal optimization models for the Refactoring Detection Problem ( Detection Problem (RDP RDP), making the approaches difficult to compare and ), making the approaches difficult to compare and reproduce reproduce
A A classical perspective classical perspective of the Refactoring Detection Problem of the Refactoring Detection Problem
A A proposed perspective proposed perspective of the Refactoring Detection Problem of the Refactoring Detection Problem
Proposed Technique Proposed Technique
The Artificial Refactoring Generation (ARGen) is... The Artificial Refactoring Generation (ARGen) is...
Everything starts with a very precise statement of metrics Everything starts with a very precise statement of metrics
[Theoretical Refactoring] Software Formalization [Theoretical Refactoring] Software Formalization
System Under Analysis (SUA) is an information system or program System Under Analysis (SUA) is an information system or program composed of classes, methods and attributes composed of classes, methods and attributes
A single class is a Cartesian product represented by A single class is a Cartesian product represented by ∗ ∗ c = str × str × str α
A single A single Class Class is a Cartesian product represented by is a Cartesian product represented by ∗ ∗ c = str × str × str α identifier fld(s) mtd(s)
What about What about Methods Methods and and Fields Fields? M ⊆ N ∗ M = str = ( str ) ⋃ n =0 n A ⊆ N ∗ A = str = ( str ) ⋃ n =0 n
A A Refactoring Refactoring is a math function that maps from a Cartesian set to a is a math function that maps from a Cartesian set to a Code Code Modification Modification R : Ω ⟶ ( CodeModification ) δ δ : Specific Refactoring Operation Specific Refactoring Operation
How to create the parameters? How to create the parameters? R : Ω ⟶ ( CodeModification ) δ
From From Source Source to to Target Target Classes Classes R : Ω ⟶ ( CodeModification ) δ R : c × A × M × c ⟶ ( CodeModification ) δ s s s t
A Quality Metric is a Function that receives a class and return a real value A Quality Metric is a Function that receives a class and return a real value η : c ⟶ R j α
We can compute any specific metric (e.g., LOC, CYCLO, LCOM2) We can compute any specific metric (e.g., LOC, CYCLO, LCOM2) η : c ⟶ R j α H = { η ( c ), η ( c ), ..., η ( c )} 1 2 α α α j α H ∈ R j α
[Theoretical Refactoring] Software Formalization [Theoretical Refactoring] Software Formalization
The Refactoring Impact Prediction is a technique to estimate the value of a The Refactoring Impact Prediction is a technique to estimate the value of a software metric after performing a refactoring operation (Chaparro, 2014) software metric after performing a refactoring operation (Chaparro, 2014) ~ δ , j ( c ) = ( c ) Prediction η δ , j α α
Lines of Code metric impacted by Move Method Refactoring Operation Lines of Code metric impacted by Move Method Refactoring Operation LOC ( c ) = LOC ( c ) − LOC ( m ) p s b s k LOC ( c ) = LOC ( c ) + LOC ( m ) p t b t k
We use the concept of a typical metric, which is represent the actual value, We use the concept of a typical metric, which is represent the actual value, and the impacted metric, which is an estimation, after accounting the and the impacted metric, which is an estimation, after accounting the refactoring operation refactoring operation ~ η : c ⟶ R : c ⟶ R η δ , j j α α Actual Actual Forecasted Forecasted Metrics Metrics Metrics Metrics
[Theoretical Refactoring] Combinatorial Optimization [Theoretical Refactoring] Combinatorial Optimization
The search space has actionable (can perform the refactoring operation) and The search space has actionable (can perform the refactoring operation) and feasible regions (fulfill the metric's constraints) feasible regions (fulfill the metric's constraints)
ARGen search space ARGen search space e.g. a system with 10 classes, 10 attributes and 10 methods would have a size e.g. a system with 10 classes, 10 attributes and 10 methods would have a size of 10,000 whether the sequence is composed of one refactoring of 10,000 whether the sequence is composed of one refactoring 2 ( C ∗ A ∗ M ) r
The objective function is a rate that compares a Predicted from Actual System The objective function is a rate that compares a Predicted from Actual System in terms of software metrics in terms of software metrics
Set of refactoring operations Set of refactoring operations J Υ (Φ ) − min (Υ (Φ )) ( ~ ~ ) ∑ j j H H w j max (Υ (Φ )) − min (Υ (Φ )) ~ ~ j j H H j =1 Obj (Φ) = + ρ (Φ) J Υ ( η ) − min (Υ ( η )) ( ) ∑ H j H j w j max (Υ ( η )) − min (Υ ( η )) H j H j j =1
Min-max normalization Min-max normalization J Υ (Φ ) − min (Υ (Φ )) ( ) ~ ~ ∑ j j H H w j max (Υ (Φ )) − min (Υ (Φ )) ~ ~ j j H H j =1 Obj (Φ) = + ρ (Φ) J Υ ( η ) − min (Υ ( η )) ( ) ∑ H j H j w j max (Υ ( η )) − min (Υ ( η )) H j H j j =1
Developers' information Developers' information J Υ (Φ ) − min (Υ (Φ )) ( ) ~ ~ ∑ j j H H w j max (Υ (Φ )) − min (Υ (Φ )) ~ ~ j j H H j =1 Obj (Φ) = + ρ (Φ) J Υ ( η ) − min (Υ ( η )) ( ) ∑ H j H j w j max (Υ ( η )) − min (Υ ( η )) H j H j j =1
Actual Metrics Actual Metrics J Υ (Φ ) − min (Υ (Φ )) ( ) ~ ~ ∑ j j H H w j max (Υ (Φ )) − min (Υ (Φ )) ~ ~ j j H H j =1 Obj (Φ) = + ρ (Φ) J Υ ( η ) − min (Υ ( η )) ( ) ∑ H j H j w j max (Υ ( η )) − min (Υ ( η )) H j H j j =1
Estimated Metrics Estimated Metrics J Υ (Φ ) − min (Υ (Φ )) ( ) ~ ~ ∑ j j H H w j max (Υ (Φ )) − min (Υ (Φ )) ~ ~ j j H H j =1 Obj (Φ) = + ρ (Φ) J Υ ( η ) − min (Υ ( η )) ( ) ∑ H j H j w j max (Υ ( η )) − min (Υ ( η )) H j H j j =1
Penalization Penalization J Υ (Φ ) − min (Υ (Φ )) ( ) ~ ~ ∑ j j H H w j max (Υ (Φ )) − min (Υ (Φ )) ~ ~ j j H H j =1 Obj (Φ) = + ρ (Φ) J Υ ( η ) − min (Υ ( η )) ( ) ∑ H j H j w j max (Υ ( η )) − min (Υ ( η )) H j H j j =1
The refactoring repair functions account a catalog of 10 constraints based on The refactoring repair functions account a catalog of 10 constraints based on object-oriented guidelines to perform repairs on the individuals object-oriented guidelines to perform repairs on the individuals
We design 6 genetic operators for the Hybrid Optimization employed We design 6 genetic operators for the Hybrid Optimization employed
[Empirical Refactoring] Computational Technique Design [Empirical Refactoring] Computational Technique Design
Building a metaphor of the system
Compute "Actual Metrics"
Configure Individuals given Fowler's Catalog
Use unalcol
Use Estimation (RIPE) and Compute Fitness
Report in a Json File
Technique Validation Technique Validation
Preliminary Experiment: Do-ability using a Shapiro-Wilk Test (non-normal Preliminary Experiment: Do-ability using a Shapiro-Wilk Test (non-normal distribution) distribution) Algorithm CCODEC[2000] ACRA[60000] Hill 0.0049 0.0015 Climbing Simulated A. 0.0222 0.0157 HaEa 0.0144 0.0340
Large Evaluations ACRA[60000] Large Evaluations ACRA[60000] Hill Climbing
Large Evaluations ACRA[60000] Large Evaluations ACRA[60000] Simulated Annealing
Large Evaluations ACRA[60000] Large Evaluations ACRA[60000]
Large Evaluations ACRA[60000] for HaEa Large Evaluations ACRA[60000] for HaEa
Large Evaluations ACRA[60000] for HaEa Large Evaluations ACRA[60000] for HaEa
Discussion Discussion
Recommend
More recommend