SlideShare a Scribd company logo
House of Cards:
Code Smells in Open-source C# Repositories
Tushar Sharma, Marios Fragkoulis, and Diomidis Spinellis
Funded	by	SENECA	project	under	
Marie-Skłodowska Curie	Actions
Code Smells
…certain structures in the code
that suggest (sometimes they
scream for) the possibility of
refactoring.
- Kent Beck
<!>
http://www.tusharma.in/smells/
A Taxonomy of Software Smells
Identified gap
• Existing mining studies on smells lack
• scale (Number of subject systems analyzed), and
• breadth (Number of smells detected)
• Solely performed on Java subject systems
Overview of the study
Research
questions
1988 open-source
repositories
Designite
<!>
19 Design smells
11 Implementation
smells
Results
Detected design smells
Abstraction smells:
• Duplicate Abstraction
• Imperative Abstraction
• Multifaceted Abstraction
• Unnecessary Abstraction
• Unutilized Abstraction
Encapsulation smells:
• Deficient Encapsulation
• Unexploited Encapsulation
Modularization smells:
• Broken Modularization
• Cyclically-dependent
Modularization
• Hub-like Modularization
• Insufficient Modularization
Hierarchy smells:
• Broken Hierarchy
• Cyclic Hierarchy
• Deep Hierarchy
• Missing Hierarchy
• Multipath Hierarchy
• Rebellious Hierarchy
• Unfactored Hierarchy
• Wide Hierarchy
Detected implementation smells
• Complex Conditional
• Complex Method
• Duplicate Code
• Empty Catch Block
• Long Identifier
• Long Method
• Long Parameter List
• Long Statement
• Magic Number
• Missing Default
• Virtual Method Call from Constructor
Mining GitHub C# repositories
Repositories 1,988
Number	of	types 436,832
Number	of	methods 2,265,971
Lines	of	Code	(C#) 49,303,314
Median	LOC 4,391
RQ1. Frequency of smells
RQ1. What is the distribution of design and
implementation smells in C# code?
Unutilized	Abstraction 90,786
Duplicate	Abstraction 73,992
Unnecessary	Abstraction 44,583
Imperative	Abstraction 11,790
Multifaceted	Abstraction 1,236
Deficient	Encapsulation 30,214
Unexploited	Encapsulation 6,964
Cyclically-dependent	
Modularization
52,436
Insufficient	
Modularization
26,429
Broken	Modularization 15,624
Hub-like	Modularization 676
Unfactored Hierarchy 20,962
Broken	Hierarchy 20,332
Rebellious	Hierarchy 11,794
Cyclic	Hierarchy 4,342
Wide	Hierarchy 3,140
Missing	Hierarchy 2,598
Multipath	Hierarchy 1,454
Deep	Hierarchy 179
RQ1. What is the distribution of design and
implementation smells in C# code?
Unutilized	Abstraction 90,786
Duplicate	Abstraction 73,992
Unnecessary	Abstraction 44,583
Imperative	Abstraction 11,790
Multifaceted	Abstraction 1,236
Deficient	Encapsulation 30,214
Unexploited	Encapsulation 6,964
Cyclically-dependent	
Modularization
52,436
Insufficient	
Modularization
26,429
Broken	Modularization 15,624
Hub-like	Modularization 676
Unfactored Hierarchy 20,962
Broken	Hierarchy 20,332
Rebellious	Hierarchy 11,794
Cyclic	Hierarchy 4,342
Wide	Hierarchy 3,140
Missing	Hierarchy 2,598
Multipath	Hierarchy 1,454
Deep	Hierarchy 179
RQ1. What is the distribution of design and
implementation smells in C# code?
Magic	Number 2,993,353
Long	Statement 462,491
Complex	Method 95,244
Long	Parameter	List 79,899
Missing	Default 23,497
Complex	Conditional 21,643
Duplicate	Code 17,921
Long	Method 17,521
Empty	Catch	Block 14,560
Long	Identifier 7,741
Virtual	Method	Call	from	
Constructor
4,545
RQ1. What is the distribution of design and
implementation smells in C# code?
Magic	Number 2,993,353
Long	Statement 462,491
Complex	Method 95,244
Long	Parameter	List 79,899
Missing	Default 23,497
Complex	Conditional 21,643
Duplicate	Code 17,921
Long	Method 17,521
Empty	Catch	Block 14,560
Long	Identifier 7,741
Virtual	Method	Call	from	
Constructor
4,545
On	average,	
one	magic	
number	smell	
per	16	lines	of	
code!!
RQ2. Inter-category co-occurrence
RQ2. What is the relationship between the
occurrence of design smells and implementation
smells?
0 5 10 15 20
0
2
4
6
8
10
12
Design Smells
ImplementationSmells
1
8
15
22
30
37
44
51
58
65
72
79
86
94
101
108
115
Counts
Co-occurrence between smell instances
⍴ = 0.78 (p-value < 2.2e-16)
Co-occurrence between smell types
⍴ = 0.80 (p-value < 2.2e-16)
The	results	emphasize	the	need	to	pay	
attention	to	smells	at	all	granularities.0 50 100 150 200 250 300
02004006008001000
Design Smells
Implementationsmells
RQ3. Intra-category co-occurrence
RQ3. Is the principle of coexistence applicable to
smells in C# projects?
𝐶 𝑠1, 𝑠2 =	
𝑛1	 ∗ 𝑛2
𝑁
RQ4. Smell density and project size
RQ4. Does smell density depend on the size of the
C# repository?
0 50000 100000 150000 200000
020406080100
LOC
DesignSmellsDensity
0 50000 100000 150000 200000
0100200300400500
LOC
ImplementationSmellsDensity
⍴ = -0.25 (p-value < 2.2e-16) ⍴ = 0.27 (p-value < 2.2e-16)
Each C# class that you work with, on average, has approximately
• 2 design smells (113*14.7/1000 = 1.67) and
• 6 implementation smells (113*55.8/1000 = 6.2)
House of Cards: Code Smells in Open-source C# Repositories

More Related Content

Similar to House of Cards: Code Smells in Open-source C# Repositories

Growing Software and Growing Ourselves
Growing Software and Growing OurselvesGrowing Software and Growing Ourselves
Growing Software and Growing Ourselves
Daniel Parkin
 
Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software Odors
Clint Edmonson
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
Dror Helper
 
Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"
GlobalLogic Ukraine
 
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Atlassian
 
Designite – Software Design Quality Assessment Tool
Designite – Software Design Quality Assessment ToolDesignite – Software Design Quality Assessment Tool
Designite – Software Design Quality Assessment Tool
Tushar Sharma
 
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0Marcel Bruch
 
Mock-interview-ppt (A)- Copy.pptx
Mock-interview-ppt (A)- Copy.pptxMock-interview-ppt (A)- Copy.pptx
Mock-interview-ppt (A)- Copy.pptx
LaxmiKabadi
 
Nodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design PatternNodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design Pattern
Talentica Software
 

Similar to House of Cards: Code Smells in Open-source C# Repositories (10)

Growing Software and Growing Ourselves
Growing Software and Growing OurselvesGrowing Software and Growing Ourselves
Growing Software and Growing Ourselves
 
Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software Odors
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
 
Tech talks#6: Code Refactoring
Tech talks#6: Code RefactoringTech talks#6: Code Refactoring
Tech talks#6: Code Refactoring
 
Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"
 
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
 
Designite – Software Design Quality Assessment Tool
Designite – Software Design Quality Assessment ToolDesignite – Software Design Quality Assessment Tool
Designite – Software Design Quality Assessment Tool
 
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
JUG Münster 2014 - Code Recommenders & Codetrails - Wissenstransfer 2.0
 
Mock-interview-ppt (A)- Copy.pptx
Mock-interview-ppt (A)- Copy.pptxMock-interview-ppt (A)- Copy.pptx
Mock-interview-ppt (A)- Copy.pptx
 
Nodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design PatternNodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design Pattern
 

More from Tushar Sharma

The tail of two source-code analysis tools - Learning and experiences
The tail of two source-code analysis tools - Learning and experiencesThe tail of two source-code analysis tools - Learning and experiences
The tail of two source-code analysis tools - Learning and experiences
Tushar Sharma
 
Designite: A Customizable Tool for Smell Mining in C# Repositories
Designite: A Customizable Tool for Smell Mining in C# RepositoriesDesignite: A Customizable Tool for Smell Mining in C# Repositories
Designite: A Customizable Tool for Smell Mining in C# Repositories
Tushar Sharma
 
Writing Maintainable Code
Writing Maintainable Code Writing Maintainable Code
Writing Maintainable Code
Tushar Sharma
 
FOSDEM - Does your configuration code smell?
FOSDEM - Does your configuration code smell?FOSDEM - Does your configuration code smell?
FOSDEM - Does your configuration code smell?
Tushar Sharma
 
Achieving Design Agility by Refactoring Design Smells
Achieving Design Agility by Refactoring Design SmellsAchieving Design Agility by Refactoring Design Smells
Achieving Design Agility by Refactoring Design Smells
Tushar Sharma
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?
Tushar Sharma
 
Does Your Configuration Code Smell?
Does Your Configuration Code Smell?Does Your Configuration Code Smell?
Does Your Configuration Code Smell?
Tushar Sharma
 
Technical debt - The elephant in the room
Technical debt - The elephant in the roomTechnical debt - The elephant in the room
Technical debt - The elephant in the room
Tushar Sharma
 
Understanding software metrics
Understanding software metricsUnderstanding software metrics
Understanding software metrics
Tushar Sharma
 
Pragmatic Technical Debt Management
Pragmatic Technical Debt ManagementPragmatic Technical Debt Management
Pragmatic Technical Debt Management
Tushar Sharma
 
Infographic - Pragmatic Technical Debt Management
Infographic - Pragmatic Technical Debt ManagementInfographic - Pragmatic Technical Debt Management
Infographic - Pragmatic Technical Debt Management
Tushar Sharma
 
Applying Design Principles in Practice
Applying Design Principles in PracticeApplying Design Principles in Practice
Applying Design Principles in Practice
Tushar Sharma
 
Why care about technical debt?
Why care about technical debt?Why care about technical debt?
Why care about technical debt?
Tushar Sharma
 
Does your design smell?
Does your design smell?Does your design smell?
Does your design smell?
Tushar Sharma
 
A Checklist for Design Reviews
A Checklist for Design ReviewsA Checklist for Design Reviews
A Checklist for Design Reviews
Tushar Sharma
 
Tools for refactoring
Tools for refactoringTools for refactoring
Tools for refactoring
Tushar Sharma
 
Towards a Principle-based Classification of Structural Design Smells
Towards a Principle-based Classification of Structural Design SmellsTowards a Principle-based Classification of Structural Design Smells
Towards a Principle-based Classification of Structural Design Smells
Tushar Sharma
 
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and EncapsulationPHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
Tushar Sharma
 
Refactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 TutorialRefactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 Tutorial
Tushar Sharma
 
Refactoring for Software Design Smells: Managing Technical Debt
Refactoring for Software Design Smells: Managing Technical DebtRefactoring for Software Design Smells: Managing Technical Debt
Refactoring for Software Design Smells: Managing Technical Debt
Tushar Sharma
 

More from Tushar Sharma (20)

The tail of two source-code analysis tools - Learning and experiences
The tail of two source-code analysis tools - Learning and experiencesThe tail of two source-code analysis tools - Learning and experiences
The tail of two source-code analysis tools - Learning and experiences
 
Designite: A Customizable Tool for Smell Mining in C# Repositories
Designite: A Customizable Tool for Smell Mining in C# RepositoriesDesignite: A Customizable Tool for Smell Mining in C# Repositories
Designite: A Customizable Tool for Smell Mining in C# Repositories
 
Writing Maintainable Code
Writing Maintainable Code Writing Maintainable Code
Writing Maintainable Code
 
FOSDEM - Does your configuration code smell?
FOSDEM - Does your configuration code smell?FOSDEM - Does your configuration code smell?
FOSDEM - Does your configuration code smell?
 
Achieving Design Agility by Refactoring Design Smells
Achieving Design Agility by Refactoring Design SmellsAchieving Design Agility by Refactoring Design Smells
Achieving Design Agility by Refactoring Design Smells
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?
 
Does Your Configuration Code Smell?
Does Your Configuration Code Smell?Does Your Configuration Code Smell?
Does Your Configuration Code Smell?
 
Technical debt - The elephant in the room
Technical debt - The elephant in the roomTechnical debt - The elephant in the room
Technical debt - The elephant in the room
 
Understanding software metrics
Understanding software metricsUnderstanding software metrics
Understanding software metrics
 
Pragmatic Technical Debt Management
Pragmatic Technical Debt ManagementPragmatic Technical Debt Management
Pragmatic Technical Debt Management
 
Infographic - Pragmatic Technical Debt Management
Infographic - Pragmatic Technical Debt ManagementInfographic - Pragmatic Technical Debt Management
Infographic - Pragmatic Technical Debt Management
 
Applying Design Principles in Practice
Applying Design Principles in PracticeApplying Design Principles in Practice
Applying Design Principles in Practice
 
Why care about technical debt?
Why care about technical debt?Why care about technical debt?
Why care about technical debt?
 
Does your design smell?
Does your design smell?Does your design smell?
Does your design smell?
 
A Checklist for Design Reviews
A Checklist for Design ReviewsA Checklist for Design Reviews
A Checklist for Design Reviews
 
Tools for refactoring
Tools for refactoringTools for refactoring
Tools for refactoring
 
Towards a Principle-based Classification of Structural Design Smells
Towards a Principle-based Classification of Structural Design SmellsTowards a Principle-based Classification of Structural Design Smells
Towards a Principle-based Classification of Structural Design Smells
 
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and EncapsulationPHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
PHAME: Principles of Hierarchy Abstraction Modularization and Encapsulation
 
Refactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 TutorialRefactoring for Design Smells - ICSE 2014 Tutorial
Refactoring for Design Smells - ICSE 2014 Tutorial
 
Refactoring for Software Design Smells: Managing Technical Debt
Refactoring for Software Design Smells: Managing Technical DebtRefactoring for Software Design Smells: Managing Technical Debt
Refactoring for Software Design Smells: Managing Technical Debt
 

Recently uploaded

A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 

Recently uploaded (20)

A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 

House of Cards: Code Smells in Open-source C# Repositories

  • 1. House of Cards: Code Smells in Open-source C# Repositories Tushar Sharma, Marios Fragkoulis, and Diomidis Spinellis Funded by SENECA project under Marie-Skłodowska Curie Actions
  • 2.
  • 3. Code Smells …certain structures in the code that suggest (sometimes they scream for) the possibility of refactoring. - Kent Beck <!>
  • 5. Identified gap • Existing mining studies on smells lack • scale (Number of subject systems analyzed), and • breadth (Number of smells detected) • Solely performed on Java subject systems
  • 6. Overview of the study Research questions 1988 open-source repositories Designite <!> 19 Design smells 11 Implementation smells Results
  • 7. Detected design smells Abstraction smells: • Duplicate Abstraction • Imperative Abstraction • Multifaceted Abstraction • Unnecessary Abstraction • Unutilized Abstraction Encapsulation smells: • Deficient Encapsulation • Unexploited Encapsulation Modularization smells: • Broken Modularization • Cyclically-dependent Modularization • Hub-like Modularization • Insufficient Modularization Hierarchy smells: • Broken Hierarchy • Cyclic Hierarchy • Deep Hierarchy • Missing Hierarchy • Multipath Hierarchy • Rebellious Hierarchy • Unfactored Hierarchy • Wide Hierarchy
  • 8. Detected implementation smells • Complex Conditional • Complex Method • Duplicate Code • Empty Catch Block • Long Identifier • Long Method • Long Parameter List • Long Statement • Magic Number • Missing Default • Virtual Method Call from Constructor
  • 9. Mining GitHub C# repositories Repositories 1,988 Number of types 436,832 Number of methods 2,265,971 Lines of Code (C#) 49,303,314 Median LOC 4,391
  • 11. RQ1. What is the distribution of design and implementation smells in C# code? Unutilized Abstraction 90,786 Duplicate Abstraction 73,992 Unnecessary Abstraction 44,583 Imperative Abstraction 11,790 Multifaceted Abstraction 1,236 Deficient Encapsulation 30,214 Unexploited Encapsulation 6,964 Cyclically-dependent Modularization 52,436 Insufficient Modularization 26,429 Broken Modularization 15,624 Hub-like Modularization 676 Unfactored Hierarchy 20,962 Broken Hierarchy 20,332 Rebellious Hierarchy 11,794 Cyclic Hierarchy 4,342 Wide Hierarchy 3,140 Missing Hierarchy 2,598 Multipath Hierarchy 1,454 Deep Hierarchy 179
  • 12. RQ1. What is the distribution of design and implementation smells in C# code? Unutilized Abstraction 90,786 Duplicate Abstraction 73,992 Unnecessary Abstraction 44,583 Imperative Abstraction 11,790 Multifaceted Abstraction 1,236 Deficient Encapsulation 30,214 Unexploited Encapsulation 6,964 Cyclically-dependent Modularization 52,436 Insufficient Modularization 26,429 Broken Modularization 15,624 Hub-like Modularization 676 Unfactored Hierarchy 20,962 Broken Hierarchy 20,332 Rebellious Hierarchy 11,794 Cyclic Hierarchy 4,342 Wide Hierarchy 3,140 Missing Hierarchy 2,598 Multipath Hierarchy 1,454 Deep Hierarchy 179
  • 13. RQ1. What is the distribution of design and implementation smells in C# code? Magic Number 2,993,353 Long Statement 462,491 Complex Method 95,244 Long Parameter List 79,899 Missing Default 23,497 Complex Conditional 21,643 Duplicate Code 17,921 Long Method 17,521 Empty Catch Block 14,560 Long Identifier 7,741 Virtual Method Call from Constructor 4,545
  • 14. RQ1. What is the distribution of design and implementation smells in C# code? Magic Number 2,993,353 Long Statement 462,491 Complex Method 95,244 Long Parameter List 79,899 Missing Default 23,497 Complex Conditional 21,643 Duplicate Code 17,921 Long Method 17,521 Empty Catch Block 14,560 Long Identifier 7,741 Virtual Method Call from Constructor 4,545 On average, one magic number smell per 16 lines of code!!
  • 16. RQ2. What is the relationship between the occurrence of design smells and implementation smells? 0 5 10 15 20 0 2 4 6 8 10 12 Design Smells ImplementationSmells 1 8 15 22 30 37 44 51 58 65 72 79 86 94 101 108 115 Counts Co-occurrence between smell instances ⍴ = 0.78 (p-value < 2.2e-16) Co-occurrence between smell types ⍴ = 0.80 (p-value < 2.2e-16) The results emphasize the need to pay attention to smells at all granularities.0 50 100 150 200 250 300 02004006008001000 Design Smells Implementationsmells
  • 18. RQ3. Is the principle of coexistence applicable to smells in C# projects? 𝐶 𝑠1, 𝑠2 = 𝑛1 ∗ 𝑛2 𝑁
  • 19. RQ4. Smell density and project size
  • 20. RQ4. Does smell density depend on the size of the C# repository? 0 50000 100000 150000 200000 020406080100 LOC DesignSmellsDensity 0 50000 100000 150000 200000 0100200300400500 LOC ImplementationSmellsDensity ⍴ = -0.25 (p-value < 2.2e-16) ⍴ = 0.27 (p-value < 2.2e-16)
  • 21. Each C# class that you work with, on average, has approximately • 2 design smells (113*14.7/1000 = 1.67) and • 6 implementation smells (113*55.8/1000 = 6.2)