SlideShare a Scribd company logo
Software Design
Anti Patterns
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Anti Pattern
■ A pattern that tells how to go from a problem to a bad solution
■ Defines what seems like an appropriate and effective solution to a problem but has
more bad consequences than good ones
– How not to solve a problem
– Negative solution to a problem
– Bad practice and common mistakes in a solution
■ Provides an identifiabletemplate for the problem and discuss its solutions
– Common vocabulary for identifying a problem and its solution
– Measures that can be taken to improve the solution
– Lessons learned from failures and their remedies
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Blob
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Blob
■ One class does most of the processing, and other classes only encapsulate data
■ Procedural design, where one class contains the majority of the process and other
classes contain the data
■ Majority of the responsibilities are allocated to a single class known as blob class
■ Symptoms:
– Single class in a system that knows too much or does too much
– One class with a large number of attributes, behaviors, or both
– One big class doing all the tasks while other classes only hold data
■ Consequences:
– Modification becomes difficult and expensive, modifying blob class affect others
– Blob class is complex to reuse or test
– Blob class may use excessive resources for simple operations
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Blob
■ Solutions:
– Increase cohesion in all the classes specially in blob class
– Migrate behaviors from blob class to their related data classes
– Identify related attributes and behaviors in blob class and move them to a new class
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Functional Decomposition
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Functional Decomposition
■ A real world action is turned into a class instead of a real world object
■ An approach that turns a subroutine into a class
■ No object oriented principles such as inheritance and polymorphism
■ Symptoms:
– Class with a functional name (named on a function instead of an object)
– Class with only a single behavior
■ Consequences:
– Hard to reuse and modify
– Documentation becomes difficult
– Lack of object oriented design
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Functional Decomposition
■ Solutions:
– Merge the class which contains a single behavior to an existing class in the system
where its related data resides
– If a class does not contain any state information, convert that class into a behavior
and insert that behavior into an appropriate existing class in the system
– Create new classes that satisfies the object oriented design and merge existing
incompatible classes into them
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Poltergeist
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Poltergeist
■ Class with limited and redundant responsibilities and short life cycle
■ Stateless class that creates unnecessary abstraction and complexity
■ Temporary class that adds an extra redundant step in navigation path
■ Symptoms:
– Class with single operations that only invoke other classes
– Class with short duration objects that only begin operations and do nothing else
■ Consequences:
– System becomes redundant and complex
– Wastage of resources
– Clutters the object oriented design
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Poltergeist
■ Solutions:
– Remove the stateless redundant class from the hierarchy and move its functionality
to the related classes
– Simplify the system by removing all the classes with transient associations and
make direct associations among related classes
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Cut & Paste Programming
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Cut & Paste Programming
■ Use existing code which is proven to work in similar situations with modification
■ Duplicate and extend already written code
■ Similar segments of code present throughout the project
■ Symptoms:
– Instead of writing code from scratch, use pre-written or partial code already
availableand extend it further
– Use an existing solution as a basis to define a new solution
■ Consequences:
– Code can be reused with minimum effort
– Same bugs reoccur throughout the software
– Difficult to review and maintain the code
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Cut & Paste Programming
■ Solutions:
– Code Mining: Find the multiple occurrences of the code segment
– Refactoring: Develop a standardized version of the code segment and replace with it
– Configuration Management: Prevent future occurrences of such code segments
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Golden Hammer
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Golden Hammer
■ To address different problems with only one solution every time
■ Forcing the one known or practiced solution to every problem instead of finding an
alternativeand more appropriatesolution
■ Using same architecture to solve diverse problems
■ Symptoms:
– Using same or identical tools to solve conceptually different problems
– Solution is changed depending on the availabletoolset
■ Consequences:
– Requirements are tailored to what the toolset does best
– Quality and performance of the solution is compromised
– Isolation from the industry
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Golden Hammer
■ Solutions:
– Select most suitable and appropriatetoolset with respect to requirements
– Explore new technologies and find best possible solutions to the problem
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Reference
■ AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis by William J.
Brown, Raphael C. Malveau, Hays W. McCormick, Thomas J. Mowbray, John Wiley &
Sons, 1998
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

More Related Content

PDF
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
PDF
7-Refactoring (Object Oriented Software Engineering - BNU Spring 2017)
PDF
10-Software Project Management (Object Oriented Software Engineering - BNU Sp...
PDF
6-Software Design Reviews (Object Oriented Software Engineering - BNU Spring ...
PDF
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
PDF
4-Object Oriented Design Heuristics (Object Oriented Software Engineering - B...
PPTX
Software Mangineeringment
PPTX
Situations vacant
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
7-Refactoring (Object Oriented Software Engineering - BNU Spring 2017)
10-Software Project Management (Object Oriented Software Engineering - BNU Sp...
6-Software Design Reviews (Object Oriented Software Engineering - BNU Spring ...
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
4-Object Oriented Design Heuristics (Object Oriented Software Engineering - B...
Software Mangineeringment
Situations vacant

Viewers also liked (20)

DOCX
Aire Acondicionado
PDF
6-Animation in Game (Game Development - UMT Spring 2017/2018)
DOCX
Liberty university busi 330 quiz 6 solutions answers slideshare
DOCX
Surds and indeces
PPTX
Economia petrolera de venezuela
PDF
Overview of Scientific Workflows - Why Use Them?
PPTX
PPTX
Swan Huntley -- We could be Beautiful -- Another upcoming Skype Interview
PPTX
Башкирский язык: Появление имени "Борис"
PDF
Exxon Mobil Analysts Meeting 2017 - Presentation
PPT
Apresentação para décimo segundo ano de 2016 7, aula 109-110
PPT
Apresentação para décimo segundo ano de 2016 7, aula 108-108 r
PPT
Ch03lect2 ud
PPT
Ch03lect1 ud
PPT
Ch05lect1 ud
PPT
Ch07lect1 ud
PPT
Ch09lect2 ud
PPT
Ch08lect2 ud
PPT
Ch08lect3 ud
PPT
Ch08lect1 ud
Aire Acondicionado
6-Animation in Game (Game Development - UMT Spring 2017/2018)
Liberty university busi 330 quiz 6 solutions answers slideshare
Surds and indeces
Economia petrolera de venezuela
Overview of Scientific Workflows - Why Use Them?
Swan Huntley -- We could be Beautiful -- Another upcoming Skype Interview
Башкирский язык: Появление имени "Борис"
Exxon Mobil Analysts Meeting 2017 - Presentation
Apresentação para décimo segundo ano de 2016 7, aula 109-110
Apresentação para décimo segundo ano de 2016 7, aula 108-108 r
Ch03lect2 ud
Ch03lect1 ud
Ch05lect1 ud
Ch07lect1 ud
Ch09lect2 ud
Ch08lect2 ud
Ch08lect3 ud
Ch08lect1 ud
Ad

Similar to 3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU Spring 2017) (20)

PDF
9-Software Verification and Validation (Object Oriented Software Engineering ...
PDF
5-Object Oriented Analysis (Object Oriented Software Engineering - BNU Spring...
PPTX
Computer science curriculum based on Program learning outcomes and objectives
PDF
L03 Software Design
PPT
DRESD Project Presentation - December 2006
PPTX
The art of architecture
PPTX
1.01.Introduction.pptx
PPSX
MDE in Practice
PDF
Lecture-2: Web development application development process model
PDF
Software Patterns
PPTX
UNIT1_Himani Sharma.pptx
PPT
Oose unit 3 ppt
PPSX
DITEC - Software Engineering
PDF
Maintaining and Releasing Open Source Software
PPTX
BPM Cluster Meeting 2018
PPTX
Software process models
PPT
OOSE Unit 3 PPT.ppt
PDF
SWEBOK Guide Evolution and Its Emerging Areas including Machine Learning Patt...
PPT
Introduction to Software Engineering
9-Software Verification and Validation (Object Oriented Software Engineering ...
5-Object Oriented Analysis (Object Oriented Software Engineering - BNU Spring...
Computer science curriculum based on Program learning outcomes and objectives
L03 Software Design
DRESD Project Presentation - December 2006
The art of architecture
1.01.Introduction.pptx
MDE in Practice
Lecture-2: Web development application development process model
Software Patterns
UNIT1_Himani Sharma.pptx
Oose unit 3 ppt
DITEC - Software Engineering
Maintaining and Releasing Open Source Software
BPM Cluster Meeting 2018
Software process models
OOSE Unit 3 PPT.ppt
SWEBOK Guide Evolution and Its Emerging Areas including Machine Learning Patt...
Introduction to Software Engineering
Ad

More from Hafiz Ammar Siddiqui (7)

PDF
4-Game Physics (Game Design and Development)
PDF
3-Game Graphics (Game Design and Development)
PDF
2-Game Design (Game Design and Development)
PDF
1-Introduction (Game Design and Development)
PDF
9-Game Design (Game Development - UMT Spring 2017/2018)
PDF
3-Graphics in Game (Game Development - UMT Spring 2017/2018)
PDF
1-Introduction (Game Development - UMT Spring 2017/2018)
4-Game Physics (Game Design and Development)
3-Game Graphics (Game Design and Development)
2-Game Design (Game Design and Development)
1-Introduction (Game Design and Development)
9-Game Design (Game Development - UMT Spring 2017/2018)
3-Graphics in Game (Game Development - UMT Spring 2017/2018)
1-Introduction (Game Development - UMT Spring 2017/2018)

Recently uploaded (20)

PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Institutional Correction lecture only . . .
PPTX
Lesson notes of climatology university.
PDF
RMMM.pdf make it easy to upload and study
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Complications of Minimal Access Surgery at WLH
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Classroom Observation Tools for Teachers
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Pre independence Education in Inndia.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Institutional Correction lecture only . . .
Lesson notes of climatology university.
RMMM.pdf make it easy to upload and study
01-Introduction-to-Information-Management.pdf
Final Presentation General Medicine 03-08-2024.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
human mycosis Human fungal infections are called human mycosis..pptx
GDM (1) (1).pptx small presentation for students
Complications of Minimal Access Surgery at WLH
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Supply Chain Operations Speaking Notes -ICLT Program
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial disease of the cardiovascular and lymphatic systems
Classroom Observation Tools for Teachers
O5-L3 Freight Transport Ops (International) V1.pdf
Anesthesia in Laparoscopic Surgery in India
Pharma ospi slides which help in ospi learning
Microbial diseases, their pathogenesis and prophylaxis
Pre independence Education in Inndia.pdf

3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU Spring 2017)

  • 1. Software Design Anti Patterns FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 2. Anti Pattern ■ A pattern that tells how to go from a problem to a bad solution ■ Defines what seems like an appropriate and effective solution to a problem but has more bad consequences than good ones – How not to solve a problem – Negative solution to a problem – Bad practice and common mistakes in a solution ■ Provides an identifiabletemplate for the problem and discuss its solutions – Common vocabulary for identifying a problem and its solution – Measures that can be taken to improve the solution – Lessons learned from failures and their remedies FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 3. Blob FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 4. Blob ■ One class does most of the processing, and other classes only encapsulate data ■ Procedural design, where one class contains the majority of the process and other classes contain the data ■ Majority of the responsibilities are allocated to a single class known as blob class ■ Symptoms: – Single class in a system that knows too much or does too much – One class with a large number of attributes, behaviors, or both – One big class doing all the tasks while other classes only hold data ■ Consequences: – Modification becomes difficult and expensive, modifying blob class affect others – Blob class is complex to reuse or test – Blob class may use excessive resources for simple operations FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 5. Blob ■ Solutions: – Increase cohesion in all the classes specially in blob class – Migrate behaviors from blob class to their related data classes – Identify related attributes and behaviors in blob class and move them to a new class FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 6. Functional Decomposition FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 7. Functional Decomposition ■ A real world action is turned into a class instead of a real world object ■ An approach that turns a subroutine into a class ■ No object oriented principles such as inheritance and polymorphism ■ Symptoms: – Class with a functional name (named on a function instead of an object) – Class with only a single behavior ■ Consequences: – Hard to reuse and modify – Documentation becomes difficult – Lack of object oriented design FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 8. Functional Decomposition ■ Solutions: – Merge the class which contains a single behavior to an existing class in the system where its related data resides – If a class does not contain any state information, convert that class into a behavior and insert that behavior into an appropriate existing class in the system – Create new classes that satisfies the object oriented design and merge existing incompatible classes into them FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 9. Poltergeist FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 10. Poltergeist ■ Class with limited and redundant responsibilities and short life cycle ■ Stateless class that creates unnecessary abstraction and complexity ■ Temporary class that adds an extra redundant step in navigation path ■ Symptoms: – Class with single operations that only invoke other classes – Class with short duration objects that only begin operations and do nothing else ■ Consequences: – System becomes redundant and complex – Wastage of resources – Clutters the object oriented design FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 11. Poltergeist ■ Solutions: – Remove the stateless redundant class from the hierarchy and move its functionality to the related classes – Simplify the system by removing all the classes with transient associations and make direct associations among related classes FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 12. Cut & Paste Programming FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 13. Cut & Paste Programming ■ Use existing code which is proven to work in similar situations with modification ■ Duplicate and extend already written code ■ Similar segments of code present throughout the project ■ Symptoms: – Instead of writing code from scratch, use pre-written or partial code already availableand extend it further – Use an existing solution as a basis to define a new solution ■ Consequences: – Code can be reused with minimum effort – Same bugs reoccur throughout the software – Difficult to review and maintain the code FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 14. Cut & Paste Programming ■ Solutions: – Code Mining: Find the multiple occurrences of the code segment – Refactoring: Develop a standardized version of the code segment and replace with it – Configuration Management: Prevent future occurrences of such code segments FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 15. Golden Hammer FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 16. Golden Hammer ■ To address different problems with only one solution every time ■ Forcing the one known or practiced solution to every problem instead of finding an alternativeand more appropriatesolution ■ Using same architecture to solve diverse problems ■ Symptoms: – Using same or identical tools to solve conceptually different problems – Solution is changed depending on the availabletoolset ■ Consequences: – Requirements are tailored to what the toolset does best – Quality and performance of the solution is compromised – Isolation from the industry FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 17. Golden Hammer ■ Solutions: – Select most suitable and appropriatetoolset with respect to requirements – Explore new technologies and find best possible solutions to the problem FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 18. Reference ■ AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis by William J. Brown, Raphael C. Malveau, Hays W. McCormick, Thomas J. Mowbray, John Wiley & Sons, 1998 FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY