SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Downloaden Sie, um offline zu lesen
Does Your Design Smell?
Tushar Sharma
http://www.tusharma.in
Cities grow, cities evolve, (...), each city
has to be renewed in order to meet the
needs of its populace. From time to time
cities are intentionally refactored (...);
most times cities are refactored in bits
(...), but sometimes the literal and
figurative debt is so great a once great
city falls into despair (...).
Grady Booch
Missing road
Unrestricted access
Hub-like road
Footpath is not a road
Deadlock!!
Multitasking
Useless… unnecessary
Complex
Beyond capacity
Why?
Every engineering discipline has to deal with
non-optimal and sub-optimal solutions.
Such solutions violate fundamental
principles of the discipline.
Smells
Design smells
Design smells are certain structures in the design that
indicate violation of fundamental design principles and
negatively impact design quality.
Design smells
Design smells are certain structures in the design that
indicate violation of fundamental design principles and
negatively impact design quality.
Missing road
This smell arises when clumps of
data or encoded strings are used
instead of creating a class or an
interface.
Missing abstraction
public class Throwable {
public void printStackTrace();
//other methods elided.
}
(Java 1)
Throwable class in JDK
public class Throwable {
public void printStackTrace();
public StackTraceElement[] getStackTrace();
//other methods elided.
}
public final class StackTraceElement {
public String getFileName();
public int getLineNumber();
public String getClassName();
public String getMethodName();
public boolean isNativeMethod();
}
Refactored in Java 1.4
(Java 1.4)
Unrestricted access
This smell occurs when the declared accessibility
of one or more members of an abstraction is
more permissive than actually required.
Deficient Encapsulation
In JDK7
• 508 classes - at least one
public field
• 96 classes - at least five
public fields
Hub-like road
This smell arises when an abstraction has dependencies
(both incoming and outgoing) with a large number of
other abstractions.
Hub-like Modularization
Component class in JDK
Footpath is not a road
This smell arises when a supertype and its subtype
conceptually do not share an “IS-A” relationship
resulting in broken substitutability.
Broken Hierarchy
Stack is not a Vector
This smell arises when two or more abstractions
depend on each other directly or indirectly.
Cyclically-dependent
Modularization
Deadlock!! Cycle!!
This smell arises when an abstraction has more than
one responsibility assigned to it.
Multifaceted Abstraction
Multitasking
Image class
• load
• process
• render
• store
Example
multiple
reasons to
change
granularity of a responsibility
This smell occurs when an abstraction that is actually
not needed (and thus could have been avoided) gets
introduced in a software design.
Unnecessary Abstraction
Useless… unnecessary
public interface WindowConstants {
/**The do-nothing default window close operation*/
public static final int DO_NOTHING_ON_CLOSE = 0;
/**The hide-window default window close operation*/
public static final int HIDE_ON_CLOSE = 1;
/**The dispose-window default window close operation*/
public static final int DISPOSE_ON_CLOSE = 2;
/**The exit application default window close operation.*/
public static final int EXIT_ON_CLOSE = 3;
}
Example
In javax.swing.WindowConstants
Insufficient Modularization
Beyond capacity!!Complex!!
This smell arises when an abstraction exists that has not
been completely decomposed, and a further
decomposition could reduce its size, implementation
complexity, or both.
Insufficient Modularization
Examples
• SocketPermission
getMask method – CC=81
• Component
259 public methods
Tools to detect design smells
Infusion
Tools to detect design smells
Designite
http://www.designite-tools.com
Tools to detect design smells
Designite
http://www.designite-tools.com
Tools to detect design smells
Designite
http://www.designite-tools.com
Tools to detect design smells
Designite
http://www.designite-tools.com
Tools to detect design smells
Designite
http://www.designite-tools.com
The message
Every engineering discipline has to deal with
non-optimal and sub-optimal solutions.
Software engineering is not an exception;
in fact, it is more prone to such smells.
Design smells – know them, avoid
them, and refactor them!
References
“Refactoring for software design
smells: Managing technical debt”
By Girish Suryanarayana, Ganesh SG,
and Tushar Sharma.
Morgan Kaufmann. ISBN 978-0128013977
http://www.designsmells.com
Tushar Sharma
@Sharma__Tushar
tusharsharma@ieee.org
http://www.tusharma.in

Weitere ähnliche Inhalte

Ă„hnlich wie Does your design smell - 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 TutorialTushar Sharma
 
Do we need SOLID principles during software development?
Do we need SOLID principles during software development?Do we need SOLID principles during software development?
Do we need SOLID principles during software development?Anna Shymchenko
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ Ganesh Samarthyam
 
Introduction to SOLID Principles
Introduction to SOLID PrinciplesIntroduction to SOLID Principles
Introduction to SOLID PrinciplesGanesh Samarthyam
 
When the Developer Must Design
When the Developer Must DesignWhen the Developer Must Design
When the Developer Must DesignAndrew Malek
 
Obvious User Interface
Obvious User InterfaceObvious User Interface
Obvious User InterfaceCody Landefeld
 
Design systems - Razvan Rosu
Design systems - Razvan RosuDesign systems - Razvan Rosu
Design systems - Razvan RosuRazvan Rosu
 
(inter)act now!
(inter)act now!(inter)act now!
(inter)act now!Rik Rijnders
 
3stages Wdn08 V3
3stages Wdn08 V33stages Wdn08 V3
3stages Wdn08 V3Boris Mann
 
Refactoring for Software Design Smells - 1 day Workshop
Refactoring for Software Design Smells - 1 day Workshop Refactoring for Software Design Smells - 1 day Workshop
Refactoring for Software Design Smells - 1 day Workshop Ganesh Samarthyam
 
Beware the monolith
Beware the monolithBeware the monolith
Beware the monolithDee Wilcox
 
Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017
Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017
Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017Zoltan Kollin
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean ArchitectureNSCoder Mexico
 
Web 2.0 for IA's
Web 2.0 for IA'sWeb 2.0 for IA's
Web 2.0 for IA'sDave Malouf
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred CowsKevlin Henney
 
OSEN SF Meetup - Business of Open Source
OSEN SF Meetup - Business of Open SourceOSEN SF Meetup - Business of Open Source
OSEN SF Meetup - Business of Open SourceJohn Mark Walker
 
ContainerDayVietnam2016: Become a Cloud-native Developer
ContainerDayVietnam2016: Become a Cloud-native DeveloperContainerDayVietnam2016: Become a Cloud-native Developer
ContainerDayVietnam2016: Become a Cloud-native DeveloperDocker-Hanoi
 
Wordcamp 2016: Embracing the boundaries of templates
Wordcamp 2016: Embracing the boundaries of templatesWordcamp 2016: Embracing the boundaries of templates
Wordcamp 2016: Embracing the boundaries of templatesLiisa Benmergui
 
From Website To Webapp Shane Morris
From Website To Webapp   Shane MorrisFrom Website To Webapp   Shane Morris
From Website To Webapp Shane MorrisShane Morris
 

Ă„hnlich wie Does your design smell - Tushar Sharma (20)

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
 
Do we need SOLID principles during software development?
Do we need SOLID principles during software development?Do we need SOLID principles during software development?
Do we need SOLID principles during software development?
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Introduction to SOLID Principles
Introduction to SOLID PrinciplesIntroduction to SOLID Principles
Introduction to SOLID Principles
 
Explicit architecture
Explicit architectureExplicit architecture
Explicit architecture
 
When the Developer Must Design
When the Developer Must DesignWhen the Developer Must Design
When the Developer Must Design
 
Obvious User Interface
Obvious User InterfaceObvious User Interface
Obvious User Interface
 
Design systems - Razvan Rosu
Design systems - Razvan RosuDesign systems - Razvan Rosu
Design systems - Razvan Rosu
 
(inter)act now!
(inter)act now!(inter)act now!
(inter)act now!
 
3stages Wdn08 V3
3stages Wdn08 V33stages Wdn08 V3
3stages Wdn08 V3
 
Refactoring for Software Design Smells - 1 day Workshop
Refactoring for Software Design Smells - 1 day Workshop Refactoring for Software Design Smells - 1 day Workshop
Refactoring for Software Design Smells - 1 day Workshop
 
Beware the monolith
Beware the monolithBeware the monolith
Beware the monolith
 
Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017
Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017
Good design is a myth - Zoltan Kollin @ UX Cambridge 2017 & UX Scotland 2017
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Web 2.0 for IA's
Web 2.0 for IA'sWeb 2.0 for IA's
Web 2.0 for IA's
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
 
OSEN SF Meetup - Business of Open Source
OSEN SF Meetup - Business of Open SourceOSEN SF Meetup - Business of Open Source
OSEN SF Meetup - Business of Open Source
 
ContainerDayVietnam2016: Become a Cloud-native Developer
ContainerDayVietnam2016: Become a Cloud-native DeveloperContainerDayVietnam2016: Become a Cloud-native Developer
ContainerDayVietnam2016: Become a Cloud-native Developer
 
Wordcamp 2016: Embracing the boundaries of templates
Wordcamp 2016: Embracing the boundaries of templatesWordcamp 2016: Embracing the boundaries of templates
Wordcamp 2016: Embracing the boundaries of templates
 
From Website To Webapp Shane Morris
From Website To Webapp   Shane MorrisFrom Website To Webapp   Shane Morris
From Website To Webapp Shane Morris
 

Mehr von Avisi B.V.

Scaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik DuindamScaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik DuindamAvisi B.V.
 
Bigger product is better - Viktor Grgric
Bigger product is better  - Viktor GrgricBigger product is better  - Viktor Grgric
Bigger product is better - Viktor GrgricAvisi B.V.
 
Software design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - JaromilSoftware design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - JaromilAvisi B.V.
 
How to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris LukassenHow to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris LukassenAvisi B.V.
 
ASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de MirandaASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de MirandaAvisi B.V.
 
ASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira JelezovaASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira JelezovaAvisi B.V.
 
ASAS 2015 Regina Chien
ASAS 2015 Regina ChienASAS 2015 Regina Chien
ASAS 2015 Regina ChienAvisi B.V.
 
ASAS 2015 Darren Harris
ASAS 2015 Darren HarrisASAS 2015 Darren Harris
ASAS 2015 Darren HarrisAvisi B.V.
 
ASAS 2015 Henk Kolk
ASAS 2015 Henk KolkASAS 2015 Henk Kolk
ASAS 2015 Henk KolkAvisi B.V.
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenAvisi B.V.
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenAvisi B.V.
 
Keynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted NewardKeynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted NewardAvisi B.V.
 
ASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia MrowcaASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia MrowcaAvisi B.V.
 
ASAS 2015 - Norberto Leite
ASAS 2015 - Norberto LeiteASAS 2015 - Norberto Leite
ASAS 2015 - Norberto LeiteAvisi B.V.
 
ASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den HeuvelASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den HeuvelAvisi B.V.
 
Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic  Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic Avisi B.V.
 
Keynote ASAS 2014 Jim Coplien - The child within
Keynote ASAS 2014 Jim Coplien - The child withinKeynote ASAS 2014 Jim Coplien - The child within
Keynote ASAS 2014 Jim Coplien - The child withinAvisi B.V.
 
ASAS 2014 - Eric Hendriks
ASAS 2014 - Eric HendriksASAS 2014 - Eric Hendriks
ASAS 2014 - Eric HendriksAvisi B.V.
 
ASAS 2014 - Viktor Grgic
ASAS 2014 - Viktor GrgicASAS 2014 - Viktor Grgic
ASAS 2014 - Viktor GrgicAvisi B.V.
 
ASAS 2014 - Daisy Rasing - de Joode
ASAS 2014 - Daisy Rasing - de JoodeASAS 2014 - Daisy Rasing - de Joode
ASAS 2014 - Daisy Rasing - de JoodeAvisi B.V.
 

Mehr von Avisi B.V. (20)

Scaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik DuindamScaling Your Team and Technology: The Agile Way - Erik Duindam
Scaling Your Team and Technology: The Agile Way - Erik Duindam
 
Bigger product is better - Viktor Grgric
Bigger product is better  - Viktor GrgricBigger product is better  - Viktor Grgric
Bigger product is better - Viktor Grgric
 
Software design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - JaromilSoftware design patterns and lessons learned from nature - Jaromil
Software design patterns and lessons learned from nature - Jaromil
 
How to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris LukassenHow to become a Product Samurai - Chris Lukassen
How to become a Product Samurai - Chris Lukassen
 
ASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de MirandaASAS 2015 - Benito de Miranda
ASAS 2015 - Benito de Miranda
 
ASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira JelezovaASAS 2015 Stanimira Jelezova
ASAS 2015 Stanimira Jelezova
 
ASAS 2015 Regina Chien
ASAS 2015 Regina ChienASAS 2015 Regina Chien
ASAS 2015 Regina Chien
 
ASAS 2015 Darren Harris
ASAS 2015 Darren HarrisASAS 2015 Darren Harris
ASAS 2015 Darren Harris
 
ASAS 2015 Henk Kolk
ASAS 2015 Henk KolkASAS 2015 Henk Kolk
ASAS 2015 Henk Kolk
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris Lukassen
 
ASAS 2015 Chris Lukassen
ASAS 2015 Chris LukassenASAS 2015 Chris Lukassen
ASAS 2015 Chris Lukassen
 
Keynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted NewardKeynote ASAS 2015 Ted Neward
Keynote ASAS 2015 Ted Neward
 
ASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia MrowcaASAS 2015 - Kasia Mrowca
ASAS 2015 - Kasia Mrowca
 
ASAS 2015 - Norberto Leite
ASAS 2015 - Norberto LeiteASAS 2015 - Norberto Leite
ASAS 2015 - Norberto Leite
 
ASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den HeuvelASAS 2015 - Maarten van den Heuvel
ASAS 2015 - Maarten van den Heuvel
 
Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic  Keynote ASAS 2015 - Viktor Grgic
Keynote ASAS 2015 - Viktor Grgic
 
Keynote ASAS 2014 Jim Coplien - The child within
Keynote ASAS 2014 Jim Coplien - The child withinKeynote ASAS 2014 Jim Coplien - The child within
Keynote ASAS 2014 Jim Coplien - The child within
 
ASAS 2014 - Eric Hendriks
ASAS 2014 - Eric HendriksASAS 2014 - Eric Hendriks
ASAS 2014 - Eric Hendriks
 
ASAS 2014 - Viktor Grgic
ASAS 2014 - Viktor GrgicASAS 2014 - Viktor Grgic
ASAS 2014 - Viktor Grgic
 
ASAS 2014 - Daisy Rasing - de Joode
ASAS 2014 - Daisy Rasing - de JoodeASAS 2014 - Daisy Rasing - de Joode
ASAS 2014 - Daisy Rasing - de Joode
 

KĂĽrzlich hochgeladen

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfWilly Marroquin (WillyDevNET)
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 

KĂĽrzlich hochgeladen (20)

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

Does your design smell - Tushar Sharma

  • 1. Does Your Design Smell? Tushar Sharma http://www.tusharma.in
  • 2. Cities grow, cities evolve, (...), each city has to be renewed in order to meet the needs of its populace. From time to time cities are intentionally refactored (...); most times cities are refactored in bits (...), but sometimes the literal and figurative debt is so great a once great city falls into despair (...). Grady Booch
  • 3.
  • 4.
  • 5.
  • 15. Why? Every engineering discipline has to deal with non-optimal and sub-optimal solutions. Such solutions violate fundamental principles of the discipline. Smells
  • 16. Design smells Design smells are certain structures in the design that indicate violation of fundamental design principles and negatively impact design quality.
  • 17. Design smells Design smells are certain structures in the design that indicate violation of fundamental design principles and negatively impact design quality.
  • 18. Missing road This smell arises when clumps of data or encoded strings are used instead of creating a class or an interface. Missing abstraction
  • 19. public class Throwable { public void printStackTrace(); //other methods elided. } (Java 1) Throwable class in JDK
  • 20. public class Throwable { public void printStackTrace(); public StackTraceElement[] getStackTrace(); //other methods elided. } public final class StackTraceElement { public String getFileName(); public int getLineNumber(); public String getClassName(); public String getMethodName(); public boolean isNativeMethod(); } Refactored in Java 1.4 (Java 1.4)
  • 21. Unrestricted access This smell occurs when the declared accessibility of one or more members of an abstraction is more permissive than actually required. Deficient Encapsulation
  • 22. In JDK7 • 508 classes - at least one public field • 96 classes - at least five public fields
  • 23. Hub-like road This smell arises when an abstraction has dependencies (both incoming and outgoing) with a large number of other abstractions. Hub-like Modularization
  • 25. Footpath is not a road This smell arises when a supertype and its subtype conceptually do not share an “IS-A” relationship resulting in broken substitutability. Broken Hierarchy
  • 26. Stack is not a Vector
  • 27. This smell arises when two or more abstractions depend on each other directly or indirectly. Cyclically-dependent Modularization Deadlock!! Cycle!!
  • 28.
  • 29. This smell arises when an abstraction has more than one responsibility assigned to it. Multifaceted Abstraction Multitasking
  • 30. Image class • load • process • render • store Example multiple reasons to change granularity of a responsibility
  • 31. This smell occurs when an abstraction that is actually not needed (and thus could have been avoided) gets introduced in a software design. Unnecessary Abstraction Useless… unnecessary
  • 32. public interface WindowConstants { /**The do-nothing default window close operation*/ public static final int DO_NOTHING_ON_CLOSE = 0; /**The hide-window default window close operation*/ public static final int HIDE_ON_CLOSE = 1; /**The dispose-window default window close operation*/ public static final int DISPOSE_ON_CLOSE = 2; /**The exit application default window close operation.*/ public static final int EXIT_ON_CLOSE = 3; } Example In javax.swing.WindowConstants
  • 34. This smell arises when an abstraction exists that has not been completely decomposed, and a further decomposition could reduce its size, implementation complexity, or both. Insufficient Modularization Examples • SocketPermission getMask method – CC=81 • Component 259 public methods
  • 35.
  • 36. Tools to detect design smells Infusion
  • 37. Tools to detect design smells Designite http://www.designite-tools.com
  • 38. Tools to detect design smells Designite http://www.designite-tools.com
  • 39. Tools to detect design smells Designite http://www.designite-tools.com
  • 40. Tools to detect design smells Designite http://www.designite-tools.com
  • 41. Tools to detect design smells Designite http://www.designite-tools.com
  • 42. The message Every engineering discipline has to deal with non-optimal and sub-optimal solutions. Software engineering is not an exception; in fact, it is more prone to such smells. Design smells – know them, avoid them, and refactor them!
  • 43. References “Refactoring for software design smells: Managing technical debt” By Girish Suryanarayana, Ganesh SG, and Tushar Sharma. Morgan Kaufmann. ISBN 978-0128013977 http://www.designsmells.com