SlideShare una empresa de Scribd logo
1 de 49
Bad smell in codes – Part 1 If it stinks change it. Presented By: Fuad Bin Omar Rashed Kibria [email_address] [email_address] www.code71.com www.code71.com
Smells to be covered ,[object Object],[object Object],[object Object],[object Object],[object Object]
Duplicated Code ,[object Object],[object Object],[object Object],[object Object]
Extract Method ,[object Object],[object Object]
Extract Method (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Extract Method (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Duplicated Code ,[object Object],[object Object],[object Object],[object Object],[object Object]
Pull Up Field ,[object Object],[object Object]
Pull Up Field (Contd.)
Duplicated Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Form template method ,[object Object],[object Object]
Form Template Method (Contd.)
Duplicated Code ,[object Object],[object Object],[object Object],[object Object],[object Object]
Substitute Algorithm ,[object Object],[object Object]
Substitute Algorithm(Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Substitute Algorithm (Contd.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Duplicated Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Extract Class ,[object Object],[object Object]
Extract Class (Contd.)
Long method ,[object Object],[object Object],[object Object]
Long method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Long method ,[object Object]
Long method ,[object Object],[object Object],[object Object],[object Object]
Replace temp with query ,[object Object],[object Object]
Replace temp with query ,[object Object],[object Object],[object Object],[object Object],[object Object]
Replace temp with query ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Long method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduce Parameter Object ,[object Object],[object Object]
Introduce Parameter Object
Preserve whole object ,[object Object],[object Object]
Preserve whole object ,[object Object],[object Object]
Preserve whole object ,[object Object]
Replace method with method object ,[object Object],[object Object]
Replace method with method object ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Replace method with method object
Long method ,[object Object],[object Object],[object Object],[object Object],[object Object]
Decompose Conditional ,[object Object],[object Object]
Decompose Conditional ,[object Object],[object Object],[object Object],[object Object]
Decompose Conditional ,[object Object],[object Object],[object Object],[object Object]
Long Parameter List ,[object Object],[object Object],[object Object],[object Object]
Replace Parameter With Method int basePrice = _quantity * _itemPrice;  discountLevel = getDiscountLevel();  double finalPrice =  discountedPrice (basePrice,discountLevel);  int basePrice = _quantity * _itemPrice;  double finalPrice = discountedPrice(basePrice);
Divergent Change ,[object Object],[object Object],[object Object],[object Object]
Shotgun Surgery ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Move Method ,[object Object],[object Object]
Introduce Parameter Object
Move Field ,[object Object],[object Object]
Introduce Parameter Object
To be continued..
References 1. Refactoring: Improving the Design of Existing Code By  Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts  2.  www.refactoring.com

Más contenido relacionado

La actualidad más candente

Cs1123 4 variables_constants
Cs1123 4 variables_constantsCs1123 4 variables_constants
Cs1123 4 variables_constants
TAlha MAlik
 

La actualidad más candente (20)

Java q ref 2018
Java q ref 2018Java q ref 2018
Java q ref 2018
 
Unit 6 pointers
Unit 6   pointersUnit 6   pointers
Unit 6 pointers
 
Python : Functions
Python : FunctionsPython : Functions
Python : Functions
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
The Ring programming language version 1.5.1 book - Part 174 of 180
The Ring programming language version 1.5.1 book - Part 174 of 180 The Ring programming language version 1.5.1 book - Part 174 of 180
The Ring programming language version 1.5.1 book - Part 174 of 180
 
Esoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basicsEsoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basics
 
Refactoring
RefactoringRefactoring
Refactoring
 
Generic programming and concepts that should be in C++
Generic programming and concepts that should be in C++Generic programming and concepts that should be in C++
Generic programming and concepts that should be in C++
 
DIWE - Fundamentals of PHP
DIWE - Fundamentals of PHPDIWE - Fundamentals of PHP
DIWE - Fundamentals of PHP
 
Refactoring
RefactoringRefactoring
Refactoring
 
Clean code
Clean codeClean code
Clean code
 
Strings v.1.1
Strings v.1.1Strings v.1.1
Strings v.1.1
 
DITEC - Programming with Java
DITEC - Programming with JavaDITEC - Programming with Java
DITEC - Programming with Java
 
Data type2 c
Data type2 cData type2 c
Data type2 c
 
DIWE - Advanced PHP Concepts
DIWE - Advanced PHP ConceptsDIWE - Advanced PHP Concepts
DIWE - Advanced PHP Concepts
 
Decaf language specification
Decaf language specificationDecaf language specification
Decaf language specification
 
DISE - Windows Based Application Development in C#
DISE - Windows Based Application Development in C#DISE - Windows Based Application Development in C#
DISE - Windows Based Application Development in C#
 
DISE - Windows Based Application Development in Java
DISE - Windows Based Application Development in JavaDISE - Windows Based Application Development in Java
DISE - Windows Based Application Development in Java
 
Cs1123 4 variables_constants
Cs1123 4 variables_constantsCs1123 4 variables_constants
Cs1123 4 variables_constants
 
Clean code slide
Clean code slideClean code slide
Clean code slide
 

Destacado

The Smells Of Bad Design
The Smells Of Bad DesignThe Smells Of Bad Design
The Smells Of Bad Design
guest446c0
 

Destacado (7)

Clean Code I - Design Patterns and Best Practices at SoCal Code Camp San Dieg...
Clean Code I - Design Patterns and Best Practices at SoCal Code Camp San Dieg...Clean Code I - Design Patterns and Best Practices at SoCal Code Camp San Dieg...
Clean Code I - Design Patterns and Best Practices at SoCal Code Camp San Dieg...
 
Design Smells
Design SmellsDesign Smells
Design Smells
 
Code Smells and How to avoid it
Code Smells and How to avoid itCode Smells and How to avoid it
Code Smells and How to avoid it
 
Refactoring Strategies: Beyond the Basics
Refactoring Strategies: Beyond the BasicsRefactoring Strategies: Beyond the Basics
Refactoring Strategies: Beyond the Basics
 
Refactoring code in .net
Refactoring code in .netRefactoring code in .net
Refactoring code in .net
 
Code Smells and Its type (With Example)
Code Smells and Its type (With Example)Code Smells and Its type (With Example)
Code Smells and Its type (With Example)
 
The Smells Of Bad Design
The Smells Of Bad DesignThe Smells Of Bad Design
The Smells Of Bad Design
 

Similar a Bad Smell in Codes - Part 1

Java căn bản - Chapter7
Java căn bản - Chapter7Java căn bản - Chapter7
Java căn bản - Chapter7
Vince Vo
 
Code Refactoring - 3.0
Code Refactoring - 3.0Code Refactoring - 3.0
Code Refactoring - 3.0
Arul Prakash
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
J. C.
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
Palak Sanghani
 

Similar a Bad Smell in Codes - Part 1 (20)

Composing method
Composing methodComposing method
Composing method
 
JAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptx
JAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptxJAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptx
JAVA METHOD AND FUNCTION DIVIDE AND SHORT.pptx
 
Refactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerRefactoring Tips by Martin Fowler
Refactoring Tips by Martin Fowler
 
Chapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part IIChapter 7 - Defining Your Own Classes - Part II
Chapter 7 - Defining Your Own Classes - Part II
 
Java căn bản - Chapter7
Java căn bản - Chapter7Java căn bản - Chapter7
Java căn bản - Chapter7
 
Methods In C-Sharp (C#)
Methods In C-Sharp (C#)Methods In C-Sharp (C#)
Methods In C-Sharp (C#)
 
Code Refactoring - 3.0
Code Refactoring - 3.0Code Refactoring - 3.0
Code Refactoring - 3.0
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Introduction to Refactoring
Introduction to RefactoringIntroduction to Refactoring
Introduction to Refactoring
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
 
Class 10
Class 10Class 10
Class 10
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Init() Day 4
Init() Day 4Init() Day 4
Init() Day 4
 
Module 4 : methods & parameters
Module 4 : methods & parametersModule 4 : methods & parameters
Module 4 : methods & parameters
 
Java execise
Java execiseJava execise
Java execise
 
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
 
Methods intro-1.0
Methods intro-1.0Methods intro-1.0
Methods intro-1.0
 
Delegate
DelegateDelegate
Delegate
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Bad Smell in Codes - Part 1