SlideShare a Scribd company logo
1 of 12
Download to read offline
REVISITING
THE RELATIONSHIP BETWEEN
CODE SMELLS AND
REFACTORING
Norihiro Yoshida (Nagoya Univ.)
Tsubasa Saika (Osaka Univ.)
Eunjong Choi (NAIST)
Ali Ouni (Osaka Univ.)
Katsuro Inoue (Osaka Univ.)
1
Code smell and Refactoring
Fowler [1] introduced a correspondence
relationship between
• Smell type
• Refactoring to remove its instance
Smell type Common Refactoring
Feature Envy Extract Method, Move Method, Pull-
up Method, Move Field
Data Class Move Method, Encapsulate Field,
Encapsulate Collection
[1] M. Fowler: “Refactoring: Improving the Design of Existing Code”,
Addison-Wesley Professional, 1999.
2
Motivation
• Bavota et al.’s investigation [2]
“40% of the refactorings was performed on classes
affected by smells, but just 7% removed the smell.”
• It does not align with Fowler’s book.
3
[2] G. Bavota, et al.: “An experimental
investigation on the innate relationship between quality and refactoring,”
Journal of Systems and Software, 2015.
Question
Why does refactoring rarely remove code smell?
Applied refactoring patterns rarely correspond to
types of the code smell.
4
In order to test the hypothesis, we empirically
investigate three OSS projects.
An Overview of This Study
Hypothesis
This study
Data we analyzed
- Refactoring instances
Refactoring instances in Bavota et al.’s dataset [3]
• They manually validated the instances.
5
Period Releases Classes Refactoring
instances
Xerces-J Oct. ‘99 - Nov. ‘10 34 19,567 6,052
ArgoUML Oct. ‘02 - Dec. ‘11 12 43,686 3,423
Ant Jan. ‘00 - Dec. ‘10 18 22,768 1,493
[3] G. Bavota et al.: “When does a refactoring induce bugs? an empirical study,”
In Proc. of SCAM 2012.
Data we analyzed
- Code smells
6
Code Smells #Classes
BlobClass 692
DataClass 1,679
DistortedHierarchy 8
GodClass 1,294
RefusedParentBequest 538
SchizophrenicClass 311
TraditionBreaker 249
Total 4,771
Code Smells #Methods
BlobOperation 4,610
DataClumps 1,402
ExternalDuplication 1,656
FeatureEnvy 1,364
IntensiveCoupling 1,290
InternalDuplication 2,218
MessageChains 31
ShotgunSurgery 65
SiblingDuplication 1,956
Total 14,592
We detected code smells from each release
version by inFusion.
List of corresponding refactoring patterns
• We made a list of the corresponding refactoring
patterns for each type of code smell.
• Referred the following books:
• M. Fowler: “Refactoring: Improving the Design of Existing Code”,
Addison-Wesley Professional, 1999.
• M. Lanza and R. Marinescu, “Object-Oriented Metrics in
Practice”, Springer-Verlag, 2005.
• Investigated the effectiveness of each refactoring
pattern for each type of code smell manually.
• Once an instance showed the effectiveness, we regarded that
the pattern corresponds to the type of code smell.
7
Investigation result
- Class-level code smell
Code Smells
#Refactored
Classes
#Classes
w/ Corresponding Refactorings
Ratio
BlobClass 210 180 85.7%
DataClass 43 8 18.6%
DistortedHierarchy 4 0 0.0%
GodClass 284 54 19.0%
RefusedParentBequest 40 7 17.5%
SchizophrenicClass 34 9 26.5%
TraditionBreaker 15 3 20.0%
Total 630 261 26.8%
8
Only 26.8% were refactored by corresponding patterns.
Only BlobClass was frequently refactored
by corresponding patterns.
Investigation result
- Method-level code smell
Code Smells
#Refactored
method
#Methods
w/ Corresponding Refactorings
Ratio
BlobOperation 436 180 68.8%
DataClumps 50 8 0.0%
ExternalDuplication 69 0 4.3%
FeatureEnvy 86 54 10.5%
IntensiveCoupling 107 7 22.4%
InternalDuplication 164 9 17.1%
MessageChains 4 3 0.0%
ShotgunSurgery 3 0 0.0%
SiblingDuplication 147 31 21.1%
Total 1,066 395 16.0%
9
Only 16.0% were refactored by corresponding patterns.
Only BlobOperation was frequently refactored
by corresponding patterns.
Discussion
10
Applied refactoring patterns rarely correspond to
types of the code smell.
Hypothesis
Only 16.0-26.8% of instances corresponded to
types of the code smell.
Investigation Result
The hypothesis is true!
Conclusion
11
Answer
Since corresponding patterns are rarely applied
to code smells, refactoring rarely removes them.
Question
Why does refactoring rarely remove code
smell?
Future Work
Replicate this study using the following
datasets / approaches.
• Other datasets of code smells [2]
• Other approach to detecting code smells [4]
• Other aproach for detecting refactoring
instances [5].
12
[2] G. Bavota, et al.: “An experimental
investigation on the innate relationship between quality and refactoring,”
Journal of Systems and Software, 2015.
[4] F. Palomba, et al.: “Mining version histories for detecting code smells,” IEEE
Trans. Softw. Eng., 2015.
[5] Z. Xing and E. Stroulia, “Refactoring detection based on UMLDiff
change-facts queries,” in Proc. of WCRE 2006.

More Related Content

Similar to Revisiting the Relationship Between Code Smells and Refactoring

Code Smell, Software Engineering
Code Smell, Software EngineeringCode Smell, Software Engineering
Code Smell, Software EngineeringAnshul Vinayak
 
Functional annotation of invertebrate genomes
Functional annotation of invertebrate genomesFunctional annotation of invertebrate genomes
Functional annotation of invertebrate genomesSurya Saha
 
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...Anthony Peruma
 
Apollo Collaborative genome annotation editing
Apollo Collaborative genome annotation editing Apollo Collaborative genome annotation editing
Apollo Collaborative genome annotation editing Monica Munoz-Torres
 
Introduction to Apollo - i5k Research Community – Calanoida (copepod)
Introduction to Apollo - i5k Research Community – Calanoida (copepod)Introduction to Apollo - i5k Research Community – Calanoida (copepod)
Introduction to Apollo - i5k Research Community – Calanoida (copepod)Monica Munoz-Torres
 
The role of annotation in reproducibility (Empirical 2014)
The role of annotation in reproducibility (Empirical 2014)The role of annotation in reproducibility (Empirical 2014)
The role of annotation in reproducibility (Empirical 2014)Oscar Corcho
 
An introduction to Web Apollo for the Biomphalaria glabatra research community.
An introduction to Web Apollo for the Biomphalaria glabatra research community.An introduction to Web Apollo for the Biomphalaria glabatra research community.
An introduction to Web Apollo for the Biomphalaria glabatra research community.Monica Munoz-Torres
 
Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...
Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...
Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...Surya Saha
 
An introduction to Web Apollo for i5K Pilot Species Projects - Hemiptera
An introduction to Web Apollo for i5K Pilot Species Projects - HemipteraAn introduction to Web Apollo for i5K Pilot Species Projects - Hemiptera
An introduction to Web Apollo for i5K Pilot Species Projects - HemipteraMonica Munoz-Torres
 
On The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityOn The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityDelft University of Technology
 
ISPAC2013 plenary talk - Environmental Forensics and PAHs
ISPAC2013 plenary talk - Environmental Forensics and PAHsISPAC2013 plenary talk - Environmental Forensics and PAHs
ISPAC2013 plenary talk - Environmental Forensics and PAHsChemistry Matters Inc.
 
Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...
Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...
Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...Nathan Dunn
 
Apollo Workshop AGS2017 Introduction
Apollo Workshop AGS2017 IntroductionApollo Workshop AGS2017 Introduction
Apollo Workshop AGS2017 IntroductionMonica Munoz-Torres
 
Linked Open Vocabulary Ranking and Terms Discovery
Linked Open Vocabulary Ranking and Terms DiscoveryLinked Open Vocabulary Ranking and Terms Discovery
Linked Open Vocabulary Ranking and Terms DiscoveryIoannis Stavrakantonakis
 
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)Ontico
 
desodorantes y antitranspirantes
desodorantes y antitranspirantesdesodorantes y antitranspirantes
desodorantes y antitranspirantessergio correa
 

Similar to Revisiting the Relationship Between Code Smells and Refactoring (20)

Code Smell, Software Engineering
Code Smell, Software EngineeringCode Smell, Software Engineering
Code Smell, Software Engineering
 
Functional annotation of invertebrate genomes
Functional annotation of invertebrate genomesFunctional annotation of invertebrate genomes
Functional annotation of invertebrate genomes
 
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
 
PhD Symposium 2014
PhD Symposium 2014PhD Symposium 2014
PhD Symposium 2014
 
Apollo Collaborative genome annotation editing
Apollo Collaborative genome annotation editing Apollo Collaborative genome annotation editing
Apollo Collaborative genome annotation editing
 
Introduction to Apollo - i5k Research Community – Calanoida (copepod)
Introduction to Apollo - i5k Research Community – Calanoida (copepod)Introduction to Apollo - i5k Research Community – Calanoida (copepod)
Introduction to Apollo - i5k Research Community – Calanoida (copepod)
 
The role of annotation in reproducibility (Empirical 2014)
The role of annotation in reproducibility (Empirical 2014)The role of annotation in reproducibility (Empirical 2014)
The role of annotation in reproducibility (Empirical 2014)
 
An introduction to Web Apollo for the Biomphalaria glabatra research community.
An introduction to Web Apollo for the Biomphalaria glabatra research community.An introduction to Web Apollo for the Biomphalaria glabatra research community.
An introduction to Web Apollo for the Biomphalaria glabatra research community.
 
Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...
Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...
Saha UC Davis Plant Pathology seminar Infrastructure for battling the Citrus ...
 
Variant analysis and whole exome sequencing
Variant analysis and whole exome sequencingVariant analysis and whole exome sequencing
Variant analysis and whole exome sequencing
 
An introduction to Web Apollo for i5K Pilot Species Projects - Hemiptera
An introduction to Web Apollo for i5K Pilot Species Projects - HemipteraAn introduction to Web Apollo for i5K Pilot Species Projects - Hemiptera
An introduction to Web Apollo for i5K Pilot Species Projects - Hemiptera
 
On The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityOn The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code Quality
 
ISPAC2013 plenary talk - Environmental Forensics and PAHs
ISPAC2013 plenary talk - Environmental Forensics and PAHsISPAC2013 plenary talk - Environmental Forensics and PAHs
ISPAC2013 plenary talk - Environmental Forensics and PAHs
 
Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...
Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...
Genome annotation with open source software: Apollo, Jbrowse and the GO in Ga...
 
Apollo Workshop AGS2017 Introduction
Apollo Workshop AGS2017 IntroductionApollo Workshop AGS2017 Introduction
Apollo Workshop AGS2017 Introduction
 
Linked Open Vocabulary Ranking and Terms Discovery
Linked Open Vocabulary Ranking and Terms DiscoveryLinked Open Vocabulary Ranking and Terms Discovery
Linked Open Vocabulary Ranking and Terms Discovery
 
Codesmells for AspectJ
Codesmells for AspectJCodesmells for AspectJ
Codesmells for AspectJ
 
Practices and Tools for Better Software Testing
Practices and Tools for  Better Software TestingPractices and Tools for  Better Software Testing
Practices and Tools for Better Software Testing
 
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
Рефакторинг Ruby-кода / Анатолий Макаревич (Evrone)
 
desodorantes y antitranspirantes
desodorantes y antitranspirantesdesodorantes y antitranspirantes
desodorantes y antitranspirantes
 

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 KLEENorihiro 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 FuzzersNorihiro Yoshida
 
ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料Norihiro Yoshida
 
コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発Norihiro Yoshida
 
Proactive Clone Recommendation System for Extract Method Refactoring
 Proactive Clone Recommendation System for Extract Method Refactoring Proactive Clone Recommendation System for Extract Method Refactoring
Proactive Clone Recommendation System for Extract Method RefactoringNorihiro 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 MutationNorihiro 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
 
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
 

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
 
ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料ソフトウェア開発における産学協創フォーラム オープニング資料
ソフトウェア開発における産学協創フォーラム オープニング資料
 
コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発コードクローン 検出・変更管理ツール群の開発
コードクローン 検出・変更管理ツール群の開発
 
Proactive Clone Recommendation System for Extract Method Refactoring
 Proactive Clone Recommendation System for Extract Method Refactoring Proactive Clone Recommendation System for Extract Method Refactoring
Proactive Clone Recommendation System for Extract Method Refactoring
 
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...
 
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

Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsDEEPRAJ PATHAK
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdfAbdul salam
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024Artur Skowroński
 
Santander Stream Processing with Apache Flink
Santander Stream Processing with Apache FlinkSantander Stream Processing with Apache Flink
Santander Stream Processing with Apache Flinkconfluent
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
What is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxWhat is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxTechnogeeks
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxRemote DBA Services
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Reviewjw364beach
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 

Recently uploaded (20)

Effort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software ProjectsEffort Estimation Techniques used in Software Projects
Effort Estimation Techniques used in Software Projects
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdf
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024
 
Santander Stream Processing with Apache Flink
Santander Stream Processing with Apache FlinkSantander Stream Processing with Apache Flink
Santander Stream Processing with Apache Flink
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
What is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxWhat is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docx
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptx
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 

Revisiting the Relationship Between Code Smells and Refactoring

  • 1. REVISITING THE RELATIONSHIP BETWEEN CODE SMELLS AND REFACTORING Norihiro Yoshida (Nagoya Univ.) Tsubasa Saika (Osaka Univ.) Eunjong Choi (NAIST) Ali Ouni (Osaka Univ.) Katsuro Inoue (Osaka Univ.) 1
  • 2. Code smell and Refactoring Fowler [1] introduced a correspondence relationship between • Smell type • Refactoring to remove its instance Smell type Common Refactoring Feature Envy Extract Method, Move Method, Pull- up Method, Move Field Data Class Move Method, Encapsulate Field, Encapsulate Collection [1] M. Fowler: “Refactoring: Improving the Design of Existing Code”, Addison-Wesley Professional, 1999. 2
  • 3. Motivation • Bavota et al.’s investigation [2] “40% of the refactorings was performed on classes affected by smells, but just 7% removed the smell.” • It does not align with Fowler’s book. 3 [2] G. Bavota, et al.: “An experimental investigation on the innate relationship between quality and refactoring,” Journal of Systems and Software, 2015. Question Why does refactoring rarely remove code smell?
  • 4. Applied refactoring patterns rarely correspond to types of the code smell. 4 In order to test the hypothesis, we empirically investigate three OSS projects. An Overview of This Study Hypothesis This study
  • 5. Data we analyzed - Refactoring instances Refactoring instances in Bavota et al.’s dataset [3] • They manually validated the instances. 5 Period Releases Classes Refactoring instances Xerces-J Oct. ‘99 - Nov. ‘10 34 19,567 6,052 ArgoUML Oct. ‘02 - Dec. ‘11 12 43,686 3,423 Ant Jan. ‘00 - Dec. ‘10 18 22,768 1,493 [3] G. Bavota et al.: “When does a refactoring induce bugs? an empirical study,” In Proc. of SCAM 2012.
  • 6. Data we analyzed - Code smells 6 Code Smells #Classes BlobClass 692 DataClass 1,679 DistortedHierarchy 8 GodClass 1,294 RefusedParentBequest 538 SchizophrenicClass 311 TraditionBreaker 249 Total 4,771 Code Smells #Methods BlobOperation 4,610 DataClumps 1,402 ExternalDuplication 1,656 FeatureEnvy 1,364 IntensiveCoupling 1,290 InternalDuplication 2,218 MessageChains 31 ShotgunSurgery 65 SiblingDuplication 1,956 Total 14,592 We detected code smells from each release version by inFusion.
  • 7. List of corresponding refactoring patterns • We made a list of the corresponding refactoring patterns for each type of code smell. • Referred the following books: • M. Fowler: “Refactoring: Improving the Design of Existing Code”, Addison-Wesley Professional, 1999. • M. Lanza and R. Marinescu, “Object-Oriented Metrics in Practice”, Springer-Verlag, 2005. • Investigated the effectiveness of each refactoring pattern for each type of code smell manually. • Once an instance showed the effectiveness, we regarded that the pattern corresponds to the type of code smell. 7
  • 8. Investigation result - Class-level code smell Code Smells #Refactored Classes #Classes w/ Corresponding Refactorings Ratio BlobClass 210 180 85.7% DataClass 43 8 18.6% DistortedHierarchy 4 0 0.0% GodClass 284 54 19.0% RefusedParentBequest 40 7 17.5% SchizophrenicClass 34 9 26.5% TraditionBreaker 15 3 20.0% Total 630 261 26.8% 8 Only 26.8% were refactored by corresponding patterns. Only BlobClass was frequently refactored by corresponding patterns.
  • 9. Investigation result - Method-level code smell Code Smells #Refactored method #Methods w/ Corresponding Refactorings Ratio BlobOperation 436 180 68.8% DataClumps 50 8 0.0% ExternalDuplication 69 0 4.3% FeatureEnvy 86 54 10.5% IntensiveCoupling 107 7 22.4% InternalDuplication 164 9 17.1% MessageChains 4 3 0.0% ShotgunSurgery 3 0 0.0% SiblingDuplication 147 31 21.1% Total 1,066 395 16.0% 9 Only 16.0% were refactored by corresponding patterns. Only BlobOperation was frequently refactored by corresponding patterns.
  • 10. Discussion 10 Applied refactoring patterns rarely correspond to types of the code smell. Hypothesis Only 16.0-26.8% of instances corresponded to types of the code smell. Investigation Result The hypothesis is true!
  • 11. Conclusion 11 Answer Since corresponding patterns are rarely applied to code smells, refactoring rarely removes them. Question Why does refactoring rarely remove code smell?
  • 12. Future Work Replicate this study using the following datasets / approaches. • Other datasets of code smells [2] • Other approach to detecting code smells [4] • Other aproach for detecting refactoring instances [5]. 12 [2] G. Bavota, et al.: “An experimental investigation on the innate relationship between quality and refactoring,” Journal of Systems and Software, 2015. [4] F. Palomba, et al.: “Mining version histories for detecting code smells,” IEEE Trans. Softw. Eng., 2015. [5] Z. Xing and E. Stroulia, “Refactoring detection based on UMLDiff change-facts queries,” in Proc. of WCRE 2006.