Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship Between Technical Debt and Refactoring

Anthony Peruma
Anthony PerumaAssistant Professor at University of Hawai‘i at Mānoa
Refactoring Debt: Myth or Reality?
An Exploratory Study on the Relationship
Between Technical Debt and Refactoring
Anthony Peruma, Eman A. AlOmar, Christian D. Newman,
Mohamed W. Mkaouer & Ali Ouni
The 19th International Conference on Mining Software Repositories
Mining Challenge Track
Intentionally documenting improvements
to the source code
Self-Admitted Technical Debt
Non-optimal code shipped to production
Technical Debt
GOAL
IMPACT
RESEARCH
QUESTIONS
CONTRIBUTION
Explore the repayment of technical debt
through refactoring operations
Provide developers and tool vendors with
insight to improve code quality
Extent of the removal of technical debt through refactoring
Types of debt addressed through refactoring
Dataset and discussion of the impact of
refactoring and debt repayment
Source Dataset
SmartSHARK
MongoDB Release 2.1
(full version)
Extracted Data
▪ SATD Removed Commits
▪ Refactoring Commits
▪ Refactoring Operations
▪ Hunks (Code Diffs)
Quantitative
Analysis
▪ Descriptive
Statistics
▪ Odds Ratio
Qualitative
Analysis
▪ Manual
Analysis of
Code
Custom Python Scripts
Experiment Design
Data Overview
▪ # of projects: 77
▪ # of project with SATD removed: 76
▪ # of commits with SATD removed: 13,259
▪ # of refactoring commits with SATD removed: 7,341
Research Questions
RQ1 – To what extent do developers refactor
code when removing technical debt?
Greater likelihood of debt repayment through refactoring activities:
• 76 of 77 systems have debt removal via refactoring
• 76 systems have an Odds Ratio > 1
• Statistically significant difference in the number of refactoring
operations applied to files
Developers apply a variety of refactoring operations:
• Extract Attribute is frequently applied multiple times followed by
Change Variable Type
Research Questions
RQ2 – What motivates a developer to refactor
their source code to remove technical debt?
Technical debt categories resolved via refactoring:
▪ Error Handling
▪ Code & Structural Improvements
▪ Feature Updates
Code & Structural Improvements
Clean-up Activities
Design Improvements
Includes removing temporary code or
renaming identifiers
Prior studies show that code clean-up is
an activity associated with refactoring
Includes moving code (such as moving
methods, method extraction, etc.) and
data type changes
Frequent bigrams & (stemmed) terms:
“get rid”, “mov”, “remov” & “chang”
Rename attribute
refactoring operation
Change data type
refactoring operation
Feature Updates
Refactoring operations developers
perform to incorporate feature changes
into the system
Frequent terms:
▪ “implement” – “FIXME: our
implementation is flawed….”
▪ “add” – “TODO: Add method to
extract...”
Extract method
refactoring operation
Error Handling
Developers knowingly write code prone
to errors or utilize generic (or auto-
generated) error handling code
(try/catch blocks)
Common bigrams: “catch block”, “error
handling”, “exception handling”, and
“throw exception”
▪ “TODO: We could use a better
strategy for error handling”
▪ “TODO: Fix exception handling”.
Potential Code Quality Tools:
• Support for robust error handling – automatic detection of
shortcomings in the code; customization of auto-generated try-
catch blocks
• Improving the accuracy of refactoring recommendations –
considering the occurrence of SATD in the code
• Aligns with existing studies showing a co-occurrence between debt
repayment and refactoring actions
• Opens the door for potential future work
A more formal and exhaustive set of causes for repayment categories
Conclusion & Takeaways
Thank You!
Anthony Peruma
h t t p s ://pe ru ma. me
1 of 11

Recommended

Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B... by
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...Anthony Peruma
225 views5 slides
SERENE 2014 Workshop: Paper "Combined Error Propagation Analysis and Runtime ... by
SERENE 2014 Workshop: Paper "Combined Error Propagation Analysis and Runtime ...SERENE 2014 Workshop: Paper "Combined Error Propagation Analysis and Runtime ...
SERENE 2014 Workshop: Paper "Combined Error Propagation Analysis and Runtime ...SERENEWorkshop
490 views26 slides
P4 Branching Overview by
P4 Branching OverviewP4 Branching Overview
P4 Branching OverviewGo2Group, Inc.
909 views24 slides
Software Reengineering by
Software ReengineeringSoftware Reengineering
Software ReengineeringDeniz Kılınç
21.6K views31 slides
Incremental Queries and Transformations for Engineering Critical Systems by
Incremental Queries and Transformations for Engineering Critical SystemsIncremental Queries and Transformations for Engineering Critical Systems
Incremental Queries and Transformations for Engineering Critical SystemsÁkos Horváth
723 views30 slides
technical debt management strategies by
technical debt management strategiestechnical debt management strategies
technical debt management strategiesRaquel Pau
72 views26 slides

More Related Content

Similar to Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship Between Technical Debt and Refactoring

Verification Engineer - Opportunities and Career Path by
Verification Engineer - Opportunities and Career PathVerification Engineer - Opportunities and Career Path
Verification Engineer - Opportunities and Career PathRamdas Mozhikunnath
15.1K views34 slides
Evolutionary Design Patterns for Software Development by
Evolutionary Design Patterns for Software Development Evolutionary Design Patterns for Software Development
Evolutionary Design Patterns for Software Development Stefan Ianta
492 views24 slides
When Architecture Meets Data by
When Architecture Meets DataWhen Architecture Meets Data
When Architecture Meets DataEoin Woods
356 views24 slides
The Use of Development History in Software Refactoring Using a Multi-Objectiv... by
The Use of Development History in Software Refactoring Using a Multi-Objectiv...The Use of Development History in Software Refactoring Using a Multi-Objectiv...
The Use of Development History in Software Refactoring Using a Multi-Objectiv...Ali Ouni
367 views28 slides
Technical debt management strategies by
Technical debt management strategiesTechnical debt management strategies
Technical debt management strategiesRaquel Pau
1.4K views36 slides
Continuous Performance Testing and Monitoring in Agile Development by
Continuous Performance Testing and Monitoring in Agile DevelopmentContinuous Performance Testing and Monitoring in Agile Development
Continuous Performance Testing and Monitoring in Agile DevelopmentDynatrace
1.6K views65 slides

Similar to Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship Between Technical Debt and Refactoring(20)

Verification Engineer - Opportunities and Career Path by Ramdas Mozhikunnath
Verification Engineer - Opportunities and Career PathVerification Engineer - Opportunities and Career Path
Verification Engineer - Opportunities and Career Path
Ramdas Mozhikunnath15.1K views
Evolutionary Design Patterns for Software Development by Stefan Ianta
Evolutionary Design Patterns for Software Development Evolutionary Design Patterns for Software Development
Evolutionary Design Patterns for Software Development
Stefan Ianta492 views
When Architecture Meets Data by Eoin Woods
When Architecture Meets DataWhen Architecture Meets Data
When Architecture Meets Data
Eoin Woods356 views
The Use of Development History in Software Refactoring Using a Multi-Objectiv... by Ali Ouni
The Use of Development History in Software Refactoring Using a Multi-Objectiv...The Use of Development History in Software Refactoring Using a Multi-Objectiv...
The Use of Development History in Software Refactoring Using a Multi-Objectiv...
Ali Ouni367 views
Technical debt management strategies by Raquel Pau
Technical debt management strategiesTechnical debt management strategies
Technical debt management strategies
Raquel Pau1.4K views
Continuous Performance Testing and Monitoring in Agile Development by Dynatrace
Continuous Performance Testing and Monitoring in Agile DevelopmentContinuous Performance Testing and Monitoring in Agile Development
Continuous Performance Testing and Monitoring in Agile Development
Dynatrace1.6K views
Industrializing Machine learning pipelines by Germain Tanguy
Industrializing Machine learning pipelinesIndustrializing Machine learning pipelines
Industrializing Machine learning pipelines
Germain Tanguy1.2K views
Lights-Out Testing for Lights-On Business by Worksoft
Lights-Out Testing for Lights-On BusinessLights-Out Testing for Lights-On Business
Lights-Out Testing for Lights-On Business
Worksoft875 views
Technical Debt and Requirements by Neil Ernst
Technical Debt and RequirementsTechnical Debt and Requirements
Technical Debt and Requirements
Neil Ernst1.2K views
Demantra Case Study Doug by sichie
Demantra Case Study DougDemantra Case Study Doug
Demantra Case Study Doug
sichie10.4K views
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media... by Amine Barrak
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 Barrak25 views
Code quality by Provectus
Code qualityCode quality
Code quality
Provectus187 views
Software Engineering as the Next Level Up from Programming (Oracle Groundbrea... by Lucas Jellema
Software Engineering as the Next Level Up from Programming (Oracle Groundbrea...Software Engineering as the Next Level Up from Programming (Oracle Groundbrea...
Software Engineering as the Next Level Up from Programming (Oracle Groundbrea...
Lucas Jellema158 views
Back to the Basics: Principles for Constructing Quality Software by TechWell
Back to the Basics: Principles for Constructing Quality SoftwareBack to the Basics: Principles for Constructing Quality Software
Back to the Basics: Principles for Constructing Quality Software
TechWell838 views
Slides4lucid by roysolay
Slides4lucidSlides4lucid
Slides4lucid
roysolay98 views
Slides4lucid by roysolay
Slides4lucidSlides4lucid
Slides4lucid
roysolay139 views
Just-in-time Detection of Protection-Impacting Changes on WordPress and Media... by Amine Barrak
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 Barrak64 views

More from Anthony Peruma

Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ... by
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...Anthony Peruma
103 views19 slides
A Primer on High-Quality Identifier Naming [ASE 2022] by
A Primer on High-Quality Identifier Naming [ASE 2022]A Primer on High-Quality Identifier Naming [ASE 2022]
A Primer on High-Quality Identifier Naming [ASE 2022]Anthony Peruma
48 views57 slides
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q... by
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...Anthony Peruma
7 views59 slides
Preparing for the Academic Job Market: Experience and Tips from a Recent F... by
Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...
Preparing for the Academic Job Market: Experience and Tips from a Recent F...Anthony Peruma
113 views24 slides
A Primer on High-Quality Identifier Naming by
A Primer on High-Quality Identifier NamingA Primer on High-Quality Identifier Naming
A Primer on High-Quality Identifier NamingAnthony Peruma
48 views55 slides
Test Anti-Patterns: From Definition to Detection by
Test Anti-Patterns: From Definition to DetectionTest Anti-Patterns: From Definition to Detection
Test Anti-Patterns: From Definition to DetectionAnthony Peruma
15 views39 slides

More from Anthony Peruma(19)

Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ... by Anthony Peruma
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Anthony Peruma103 views
A Primer on High-Quality Identifier Naming [ASE 2022] by Anthony Peruma
A Primer on High-Quality Identifier Naming [ASE 2022]A Primer on High-Quality Identifier Naming [ASE 2022]
A Primer on High-Quality Identifier Naming [ASE 2022]
Anthony Peruma48 views
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q... by Anthony Peruma
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Anthony Peruma7 views
Preparing for the Academic Job Market: Experience and Tips from a Recent F... by Anthony Peruma
Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
Anthony Peruma113 views
A Primer on High-Quality Identifier Naming by Anthony Peruma
A Primer on High-Quality Identifier NamingA Primer on High-Quality Identifier Naming
A Primer on High-Quality Identifier Naming
Anthony Peruma48 views
Test Anti-Patterns: From Definition to Detection by Anthony Peruma
Test Anti-Patterns: From Definition to DetectionTest Anti-Patterns: From Definition to Detection
Test Anti-Patterns: From Definition to Detection
Anthony Peruma15 views
Understanding Digits in Identifier Names: An Exploratory Study by Anthony Peruma
Understanding Digits in Identifier Names: An Exploratory StudyUnderstanding Digits in Identifier Names: An Exploratory Study
Understanding Digits in Identifier Names: An Exploratory Study
Anthony Peruma167 views
IDEAL: An Open-Source Identifier Name Appraisal Tool by Anthony Peruma
IDEAL: An Open-Source Identifier Name Appraisal ToolIDEAL: An Open-Source Identifier Name Appraisal Tool
IDEAL: An Open-Source Identifier Name Appraisal Tool
Anthony Peruma110 views
Using Grammar Patterns to Interpret Test Method Name Evolution by Anthony Peruma
Using Grammar Patterns to Interpret Test Method Name EvolutionUsing Grammar Patterns to Interpret Test Method Name Evolution
Using Grammar Patterns to Interpret Test Method Name Evolution
Anthony Peruma64 views
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator... by Anthony Peruma
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
Anthony Peruma62 views
Contextualizing Rename Decisions using Refactorings and Commit Messages by Anthony Peruma
Contextualizing Rename Decisions using Refactorings and Commit MessagesContextualizing Rename Decisions using Refactorings and Commit Messages
Contextualizing Rename Decisions using Refactorings and Commit Messages
Anthony Peruma129 views
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica... by Anthony Peruma
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 Peruma115 views
On the Distribution of Test Smells in Open Source Android Applications: An Ex... by Anthony Peruma
On the Distribution of Test Smells in Open Source Android Applications: An Ex...On the Distribution of Test Smells in Open Source Android Applications: An Ex...
On the Distribution of Test Smells in Open Source Android Applications: An Ex...
Anthony Peruma128 views
A Preliminary Study of Android Refactorings by Anthony Peruma
A Preliminary Study of Android RefactoringsA Preliminary Study of Android Refactorings
A Preliminary Study of Android Refactorings
Anthony Peruma167 views
Permission Issues in Open-Source Android Apps: An Exploratory Study by Anthony Peruma
Permission Issues in Open-Source Android Apps: An Exploratory StudyPermission Issues in Open-Source Android Apps: An Exploratory Study
Permission Issues in Open-Source Android Apps: An Exploratory Study
Anthony Peruma163 views
Web Content Management - Introduction by Anthony Peruma
Web Content Management - IntroductionWeb Content Management - Introduction
Web Content Management - Introduction
Anthony Peruma596 views
SharePoint 2013 - Search Driven Publishing by Anthony Peruma
SharePoint 2013 - Search Driven PublishingSharePoint 2013 - Search Driven Publishing
SharePoint 2013 - Search Driven Publishing
Anthony Peruma751 views

Recently uploaded

DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove... by
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...Deltares
15 views17 slides
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...Deltares
7 views24 slides
Advanced API Mocking Techniques by
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking TechniquesDimpy Adhikary
18 views11 slides
Software evolution understanding: Automatic extraction of software identifier... by
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...Ra'Fat Al-Msie'deen
7 views33 slides
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon by
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDeltares
11 views43 slides
SAP FOR TYRE INDUSTRY.pdf by
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdfVirendra Rai, PMP
19 views3 slides

Recently uploaded(20)

DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove... by Deltares
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
Deltares15 views
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares7 views
Advanced API Mocking Techniques by Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary18 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon by Deltares
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
Deltares11 views
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... by Deltares
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
Deltares9 views
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares12 views
How to Make the Most of Regression and Unit Testing.pdf by Abhay Kumar
How to Make the Most of Regression and Unit Testing.pdfHow to Make the Most of Regression and Unit Testing.pdf
How to Make the Most of Regression and Unit Testing.pdf
Abhay Kumar10 views
Citi TechTalk Session 2: Kafka Deep Dive by confluent
Citi TechTalk Session 2: Kafka Deep DiveCiti TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep Dive
confluent17 views
Les nouveautés produit Neo4j by Neo4j
 Les nouveautés produit Neo4j Les nouveautés produit Neo4j
Les nouveautés produit Neo4j
Neo4j27 views
Tridens DevOps by Tridens
Tridens DevOpsTridens DevOps
Tridens DevOps
Tridens9 views
Roadmap y Novedades de producto by Neo4j
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de producto
Neo4j43 views
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023 by Icinga
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Upgrading Incident Management with Icinga - Icinga Camp Milan 2023
Icinga36 views
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
Deltares16 views
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida by Deltares
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - PridaDSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
Deltares17 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares10 views

Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship Between Technical Debt and Refactoring

  • 1. Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship Between Technical Debt and Refactoring Anthony Peruma, Eman A. AlOmar, Christian D. Newman, Mohamed W. Mkaouer & Ali Ouni The 19th International Conference on Mining Software Repositories Mining Challenge Track
  • 2. Intentionally documenting improvements to the source code Self-Admitted Technical Debt Non-optimal code shipped to production Technical Debt
  • 3. GOAL IMPACT RESEARCH QUESTIONS CONTRIBUTION Explore the repayment of technical debt through refactoring operations Provide developers and tool vendors with insight to improve code quality Extent of the removal of technical debt through refactoring Types of debt addressed through refactoring Dataset and discussion of the impact of refactoring and debt repayment
  • 4. Source Dataset SmartSHARK MongoDB Release 2.1 (full version) Extracted Data ▪ SATD Removed Commits ▪ Refactoring Commits ▪ Refactoring Operations ▪ Hunks (Code Diffs) Quantitative Analysis ▪ Descriptive Statistics ▪ Odds Ratio Qualitative Analysis ▪ Manual Analysis of Code Custom Python Scripts Experiment Design Data Overview ▪ # of projects: 77 ▪ # of project with SATD removed: 76 ▪ # of commits with SATD removed: 13,259 ▪ # of refactoring commits with SATD removed: 7,341
  • 5. Research Questions RQ1 – To what extent do developers refactor code when removing technical debt? Greater likelihood of debt repayment through refactoring activities: • 76 of 77 systems have debt removal via refactoring • 76 systems have an Odds Ratio > 1 • Statistically significant difference in the number of refactoring operations applied to files Developers apply a variety of refactoring operations: • Extract Attribute is frequently applied multiple times followed by Change Variable Type
  • 6. Research Questions RQ2 – What motivates a developer to refactor their source code to remove technical debt? Technical debt categories resolved via refactoring: ▪ Error Handling ▪ Code & Structural Improvements ▪ Feature Updates
  • 7. Code & Structural Improvements Clean-up Activities Design Improvements Includes removing temporary code or renaming identifiers Prior studies show that code clean-up is an activity associated with refactoring Includes moving code (such as moving methods, method extraction, etc.) and data type changes Frequent bigrams & (stemmed) terms: “get rid”, “mov”, “remov” & “chang” Rename attribute refactoring operation Change data type refactoring operation
  • 8. Feature Updates Refactoring operations developers perform to incorporate feature changes into the system Frequent terms: ▪ “implement” – “FIXME: our implementation is flawed….” ▪ “add” – “TODO: Add method to extract...” Extract method refactoring operation
  • 9. Error Handling Developers knowingly write code prone to errors or utilize generic (or auto- generated) error handling code (try/catch blocks) Common bigrams: “catch block”, “error handling”, “exception handling”, and “throw exception” ▪ “TODO: We could use a better strategy for error handling” ▪ “TODO: Fix exception handling”.
  • 10. Potential Code Quality Tools: • Support for robust error handling – automatic detection of shortcomings in the code; customization of auto-generated try- catch blocks • Improving the accuracy of refactoring recommendations – considering the occurrence of SATD in the code • Aligns with existing studies showing a co-occurrence between debt repayment and refactoring actions • Opens the door for potential future work A more formal and exhaustive set of causes for repayment categories Conclusion & Takeaways
  • 11. Thank You! Anthony Peruma h t t p s ://pe ru ma. me