SlideShare a Scribd company logo
What is Design Pattern?
● A design pattern is a generic reusable solution to a commonly occurring
problem in software design.
● It is not a specific piece of code, but rather a template or blueprint that can be
used to solve different problems
● It is not specific to a particular programming language but can be applied
across different languages
Metaphor of Design Pattern
● Think of design pattern like a recipe for cooking
● Design patterns are "recipes" for solving specific software problems.
● It outlines the key ingredients (objects, relationships, functionalities) and steps
involved
Benefits of using software design patterns and when to use design pattern
Benefits of Design Pattern
Reusability:
Design patterns are proven solutions to common problems, eliminating the need to
"reinvent the wheel"
Scalability:
Design patterns promote flexibility to accommodate future growth without major
code rewrites.
Benefits of Design Pattern
Maintainability:
Design patterns often lead to modular code that is easy to understand and modify.
This helps in maintenance and bug fixes.
Readability and Understandability:
Design patterns often come with well-known names and structures that are widely
recognized in the development community.
Benefits of Design Pattern
Performance Optimization:
Certain design patterns can contribute to better performance. Example, the
Singleton can help manage resources efficiently.
Testability:
Pattern-based code often has well-defined interfaces and dependencies, making it
easier to write unit and integration tests. This improves code quality.
Drawbacks of Design Pattern
Choosing the wrong pattern:
Applying a pattern without understanding its purpose can lead to over-complicated
code that don't address the actual problem.
Blindly following patterns:
Patterns are not one-size-fits-all solutions. Applying them rigidly without
considering the specific context can hinder flexibility and creativity.
Drawbacks of Design Pattern
Overhead and Complexity:
Applying design patterns can introduce additional layers of abstraction and
complexity to the codebase. This might be unnecessary for simpler applications.
Overengineering:
Overusing design patterns or using them inappropriately can lead to over
engineered solutions.
Drawbacks of Design Pattern
Performance Concerns:
While abstraction is valuable, too many layers of abstraction can add processing
overhead and impact performance.
Rigidity:
Over-reliance on design patterns can make the codebase rigid and less adaptable
to change.
When to use design patterns?
When to use Singleton pattern?
● Managing a single instance of a resource.
● Example: database connection, logger, configuration manager
When to use Builder pattern?
● When the entity has numerous optional parameters to create an object
● Complex object construction.
● Building hierarchical structures like trees or composite objects.
● Deferring object creation until all necessary data is available.
● Implementing validation logic during object construction.
When to use Facade pattern?
● When dealing with a subsystem containing numerous intricate interfaces.
● Decouple clients by providing an abstraction layer
● Implement access control and authorization mechanisms
● Centralized logging and auditing operations
● When common operations involve interacting with multiple components
When to use Adapter pattern?
● When two incompatible interfaces to work together seamlessly.
● If we intend to reuse existing code with different interfaces in multiple
contexts.
● Standardize access to various database systems with their unique APIs.
● Interact with devices having different communication protocols through a
common interface.
When to use Decorator pattern?
● Dynamically enhance object behavior at runtime
● GUI component customization using decorators without changing the
component itself
● Extending Functionality using filters, interceptors etc
● Build modular and easily extendable middleware
When to use Strategy pattern?
● Integrate with different payment gateways via interchangeable strategy
objects.
● Different sorting algorithms (mergesort, quicksort) based on user preference.
● Isolate different data access strategies (e.g., JDBC, ORM) behind a common
interface for easier switching.
● Implement various logging strategies for different environments (dev, prod).
● We need to extend the system's functionality without breaking existing clients.
When to use State pattern?
● The shopping cart can be in different states like "Empty", "Items Added",
"Checkout Started", "Payment Completed".
● Based user roles, states like "Logged Out", "Regular User", "Admin" can
dynamically limit different functionality.
● When we have workflow states like "Submitted", "In Review", "Approved",
"Rejected"
● System and Component Life Cycles
Design Pattern usage in Address Forms
The official class syntax is currently not part of the core React library. In our
address form, we tried to use the concepts of multiple design patterns.
● Strategy Pattern
● Decorator pattern
● State pattern
Decorator Pattern in Address Forms
Strategy Pattern in Address Forms
Thank You.
Ad

More Related Content

What's hot (20)

Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
Satheesh Sukumaran
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
Emertxe Information Technologies Pvt Ltd
 
Ch18
Ch18Ch18
Ch18
phanleson
 
Online News Portal System
Online News Portal SystemOnline News Portal System
Online News Portal System
Rajib Roy
 
ELECTRICITY BILLING SYSTEM (1).pptx
ELECTRICITY BILLING SYSTEM (1).pptxELECTRICITY BILLING SYSTEM (1).pptx
ELECTRICITY BILLING SYSTEM (1).pptx
ABHISHEKJADHAV106697
 
Context model
Context modelContext model
Context model
Ubaid423
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
Asma CHERIF
 
tour management system
tour management systemtour management system
tour management system
Khwaja Yunus Ali Medical University
 
ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)
ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)
ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)
IJCSEA Journal
 
Chat bot in_pythion
Chat bot in_pythionChat bot in_pythion
Chat bot in_pythion
ShivendraPratapSingh84
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
Kanushka Gayan
 
Hotel management or reservation system document
Hotel management or reservation system document Hotel management or reservation system document
Hotel management or reservation system document
prabhat kumar
 
SRS (Latest).pdf
SRS (Latest).pdfSRS (Latest).pdf
SRS (Latest).pdf
AsraNadeem4
 
Reconstructing Software Architecture
Reconstructing Software ArchitectureReconstructing Software Architecture
Reconstructing Software Architecture
Himanshu
 
Web Engineering - Web Applications versus Conventional Software
Web Engineering - Web Applications versus Conventional SoftwareWeb Engineering - Web Applications versus Conventional Software
Web Engineering - Web Applications versus Conventional Software
Nosheen Qamar
 
Sequence diagram smart stock business
Sequence diagram  smart stock businessSequence diagram  smart stock business
Sequence diagram smart stock business
tasnimmohiuddin
 
Jayashan-cb004082-Criminal Face Recognition-Final
Jayashan-cb004082-Criminal Face Recognition-FinalJayashan-cb004082-Criminal Face Recognition-Final
Jayashan-cb004082-Criminal Face Recognition-Final
Jayashan Fernando
 
Report on web development
Report on web developmentReport on web development
Report on web development
AJEETKUMAR932614
 
Liteon company june 2017
Liteon company june 2017Liteon company june 2017
Liteon company june 2017
志杰 林
 
Webディレクター用ポートフォリオテンプレート
Webディレクター用ポートフォリオテンプレートWebディレクター用ポートフォリオテンプレート
Webディレクター用ポートフォリオテンプレート
toksato
 
Online News Portal System
Online News Portal SystemOnline News Portal System
Online News Portal System
Rajib Roy
 
ELECTRICITY BILLING SYSTEM (1).pptx
ELECTRICITY BILLING SYSTEM (1).pptxELECTRICITY BILLING SYSTEM (1).pptx
ELECTRICITY BILLING SYSTEM (1).pptx
ABHISHEKJADHAV106697
 
Context model
Context modelContext model
Context model
Ubaid423
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
Asma CHERIF
 
ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)
ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)
ORGAN DONATION MANAGEMENT SYSTEM (PROJECT: ODMS)
IJCSEA Journal
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
Kanushka Gayan
 
Hotel management or reservation system document
Hotel management or reservation system document Hotel management or reservation system document
Hotel management or reservation system document
prabhat kumar
 
SRS (Latest).pdf
SRS (Latest).pdfSRS (Latest).pdf
SRS (Latest).pdf
AsraNadeem4
 
Reconstructing Software Architecture
Reconstructing Software ArchitectureReconstructing Software Architecture
Reconstructing Software Architecture
Himanshu
 
Web Engineering - Web Applications versus Conventional Software
Web Engineering - Web Applications versus Conventional SoftwareWeb Engineering - Web Applications versus Conventional Software
Web Engineering - Web Applications versus Conventional Software
Nosheen Qamar
 
Sequence diagram smart stock business
Sequence diagram  smart stock businessSequence diagram  smart stock business
Sequence diagram smart stock business
tasnimmohiuddin
 
Jayashan-cb004082-Criminal Face Recognition-Final
Jayashan-cb004082-Criminal Face Recognition-FinalJayashan-cb004082-Criminal Face Recognition-Final
Jayashan-cb004082-Criminal Face Recognition-Final
Jayashan Fernando
 
Liteon company june 2017
Liteon company june 2017Liteon company june 2017
Liteon company june 2017
志杰 林
 
Webディレクター用ポートフォリオテンプレート
Webディレクター用ポートフォリオテンプレートWebディレクター用ポートフォリオテンプレート
Webディレクター用ポートフォリオテンプレート
toksato
 

Similar to Benefits of using software design patterns and when to use design pattern (20)

Design Patterns In Scala
Design Patterns In ScalaDesign Patterns In Scala
Design Patterns In Scala
Knoldus Inc.
 
Introduction to Domain driven design
Introduction to Domain driven designIntroduction to Domain driven design
Introduction to Domain driven design
Muhammad Ali
 
Contributions: what they are and how to find them
Contributions: what they are and how to find themContributions: what they are and how to find them
Contributions: what they are and how to find them
Pedro Cambra
 
Design patterns
Design patternsDesign patterns
Design patterns
Ahmed Elharouny
 
CHAPTER12.ppt
CHAPTER12.pptCHAPTER12.ppt
CHAPTER12.ppt
CharenReposposa
 
Unit iv -Documenting and Implementation of Software Architecture
Unit iv -Documenting and Implementation of Software ArchitectureUnit iv -Documenting and Implementation of Software Architecture
Unit iv -Documenting and Implementation of Software Architecture
Dhivyaa C.R
 
System design process.pptx
System design process.pptxSystem design process.pptx
System design process.pptx
NajibMuhammad16
 
Software System Engineering - Chapter 15
Software System Engineering - Chapter 15Software System Engineering - Chapter 15
Software System Engineering - Chapter 15
Fadhil Ismail
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Up2 Technology
 
Object oriented sad-5 part i
Object oriented sad-5 part iObject oriented sad-5 part i
Object oriented sad-5 part i
Bisrat Girma
 
Modern UI Architecture_ Trends and Technologies in Web Development
Modern UI Architecture_ Trends and Technologies in Web DevelopmentModern UI Architecture_ Trends and Technologies in Web Development
Modern UI Architecture_ Trends and Technologies in Web Development
Suresh Patidar
 
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
David Litvak Bruno
 
Design pattern
Design patternDesign pattern
Design pattern
Shreyance Jain
 
[DevDay2018] Embrace the challenge – working as a developer in Content Manage...
[DevDay2018] Embrace the challenge – working as a developer in Content Manage...[DevDay2018] Embrace the challenge – working as a developer in Content Manage...
[DevDay2018] Embrace the challenge – working as a developer in Content Manage...
DevDay Da Nang
 
Software design
Software designSoftware design
Software design
Benazir Fathima
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Knoldus Inc.
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
NSCoder Mexico
 
UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...
UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...
UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...
MANOJ964697
 
Architecture and UML diagrams, types of UML diagrams, types of architecture a...
Architecture and UML diagrams, types of UML diagrams, types of architecture a...Architecture and UML diagrams, types of UML diagrams, types of architecture a...
Architecture and UML diagrams, types of UML diagrams, types of architecture a...
MANOJ964697
 
Design final
Design finalDesign final
Design final
Indu Sharma Bhardwaj
 
Design Patterns In Scala
Design Patterns In ScalaDesign Patterns In Scala
Design Patterns In Scala
Knoldus Inc.
 
Introduction to Domain driven design
Introduction to Domain driven designIntroduction to Domain driven design
Introduction to Domain driven design
Muhammad Ali
 
Contributions: what they are and how to find them
Contributions: what they are and how to find themContributions: what they are and how to find them
Contributions: what they are and how to find them
Pedro Cambra
 
Unit iv -Documenting and Implementation of Software Architecture
Unit iv -Documenting and Implementation of Software ArchitectureUnit iv -Documenting and Implementation of Software Architecture
Unit iv -Documenting and Implementation of Software Architecture
Dhivyaa C.R
 
System design process.pptx
System design process.pptxSystem design process.pptx
System design process.pptx
NajibMuhammad16
 
Software System Engineering - Chapter 15
Software System Engineering - Chapter 15Software System Engineering - Chapter 15
Software System Engineering - Chapter 15
Fadhil Ismail
 
Object oriented sad-5 part i
Object oriented sad-5 part iObject oriented sad-5 part i
Object oriented sad-5 part i
Bisrat Girma
 
Modern UI Architecture_ Trends and Technologies in Web Development
Modern UI Architecture_ Trends and Technologies in Web DevelopmentModern UI Architecture_ Trends and Technologies in Web Development
Modern UI Architecture_ Trends and Technologies in Web Development
Suresh Patidar
 
Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018Design patterns for fun & profit - CoderCruise 2018
Design patterns for fun & profit - CoderCruise 2018
David Litvak Bruno
 
[DevDay2018] Embrace the challenge – working as a developer in Content Manage...
[DevDay2018] Embrace the challenge – working as a developer in Content Manage...[DevDay2018] Embrace the challenge – working as a developer in Content Manage...
[DevDay2018] Embrace the challenge – working as a developer in Content Manage...
DevDay Da Nang
 
UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...
UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...
UNIT_III_Design Engineering, design engineering, architecture, patterns, UML ...
MANOJ964697
 
Architecture and UML diagrams, types of UML diagrams, types of architecture a...
Architecture and UML diagrams, types of UML diagrams, types of architecture a...Architecture and UML diagrams, types of UML diagrams, types of architecture a...
Architecture and UML diagrams, types of UML diagrams, types of architecture a...
MANOJ964697
 
Ad

Recently uploaded (20)

Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025
GrapesTech Solutions
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Medical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk ScoringMedical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk Scoring
ICS
 
Programs as Values - Write code and don't get lost
Programs as Values - Write code and don't get lostPrograms as Values - Write code and don't get lost
Programs as Values - Write code and don't get lost
Pierangelo Cecchetto
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
Buy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training techBuy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training tech
Rustici Software
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Autodesk Inventor Crack (2025) Latest
Autodesk Inventor    Crack (2025) LatestAutodesk Inventor    Crack (2025) Latest
Autodesk Inventor Crack (2025) Latest
Google
 
Sequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptxSequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptx
aashrithakondapalli8
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
AEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural MeetingAEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural Meeting
jennaf3
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
The Elixir Developer - All Things Open
The Elixir Developer - All Things OpenThe Elixir Developer - All Things Open
The Elixir Developer - All Things Open
Carlo Gilmar Padilla Santana
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Digital Twins Software Service in Belfast
Digital Twins Software Service in BelfastDigital Twins Software Service in Belfast
Digital Twins Software Service in Belfast
julia smits
 
How to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber PluginHow to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber Plugin
eGrabber
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025Top 12 Most Useful AngularJS Development Tools to Use in 2025
Top 12 Most Useful AngularJS Development Tools to Use in 2025
GrapesTech Solutions
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Medical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk ScoringMedical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk Scoring
ICS
 
Programs as Values - Write code and don't get lost
Programs as Values - Write code and don't get lostPrograms as Values - Write code and don't get lost
Programs as Values - Write code and don't get lost
Pierangelo Cecchetto
 
Wilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For WindowsWilcom Embroidery Studio Crack 2025 For Windows
Wilcom Embroidery Studio Crack 2025 For Windows
Google
 
Buy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training techBuy vs. Build: Unlocking the right path for your training tech
Buy vs. Build: Unlocking the right path for your training tech
Rustici Software
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Autodesk Inventor Crack (2025) Latest
Autodesk Inventor    Crack (2025) LatestAutodesk Inventor    Crack (2025) Latest
Autodesk Inventor Crack (2025) Latest
Google
 
Sequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptxSequence Diagrams With Pictures (1).pptx
Sequence Diagrams With Pictures (1).pptx
aashrithakondapalli8
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
AEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural MeetingAEM User Group DACH - 2025 Inaugural Meeting
AEM User Group DACH - 2025 Inaugural Meeting
jennaf3
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Digital Twins Software Service in Belfast
Digital Twins Software Service in BelfastDigital Twins Software Service in Belfast
Digital Twins Software Service in Belfast
julia smits
 
How to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber PluginHow to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber Plugin
eGrabber
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Ad

Benefits of using software design patterns and when to use design pattern

  • 1. What is Design Pattern? ● A design pattern is a generic reusable solution to a commonly occurring problem in software design. ● It is not a specific piece of code, but rather a template or blueprint that can be used to solve different problems ● It is not specific to a particular programming language but can be applied across different languages
  • 2. Metaphor of Design Pattern ● Think of design pattern like a recipe for cooking ● Design patterns are "recipes" for solving specific software problems. ● It outlines the key ingredients (objects, relationships, functionalities) and steps involved
  • 4. Benefits of Design Pattern Reusability: Design patterns are proven solutions to common problems, eliminating the need to "reinvent the wheel" Scalability: Design patterns promote flexibility to accommodate future growth without major code rewrites.
  • 5. Benefits of Design Pattern Maintainability: Design patterns often lead to modular code that is easy to understand and modify. This helps in maintenance and bug fixes. Readability and Understandability: Design patterns often come with well-known names and structures that are widely recognized in the development community.
  • 6. Benefits of Design Pattern Performance Optimization: Certain design patterns can contribute to better performance. Example, the Singleton can help manage resources efficiently. Testability: Pattern-based code often has well-defined interfaces and dependencies, making it easier to write unit and integration tests. This improves code quality.
  • 7. Drawbacks of Design Pattern Choosing the wrong pattern: Applying a pattern without understanding its purpose can lead to over-complicated code that don't address the actual problem. Blindly following patterns: Patterns are not one-size-fits-all solutions. Applying them rigidly without considering the specific context can hinder flexibility and creativity.
  • 8. Drawbacks of Design Pattern Overhead and Complexity: Applying design patterns can introduce additional layers of abstraction and complexity to the codebase. This might be unnecessary for simpler applications. Overengineering: Overusing design patterns or using them inappropriately can lead to over engineered solutions.
  • 9. Drawbacks of Design Pattern Performance Concerns: While abstraction is valuable, too many layers of abstraction can add processing overhead and impact performance. Rigidity: Over-reliance on design patterns can make the codebase rigid and less adaptable to change.
  • 10. When to use design patterns?
  • 11. When to use Singleton pattern? ● Managing a single instance of a resource. ● Example: database connection, logger, configuration manager
  • 12. When to use Builder pattern? ● When the entity has numerous optional parameters to create an object ● Complex object construction. ● Building hierarchical structures like trees or composite objects. ● Deferring object creation until all necessary data is available. ● Implementing validation logic during object construction.
  • 13. When to use Facade pattern? ● When dealing with a subsystem containing numerous intricate interfaces. ● Decouple clients by providing an abstraction layer ● Implement access control and authorization mechanisms ● Centralized logging and auditing operations ● When common operations involve interacting with multiple components
  • 14. When to use Adapter pattern? ● When two incompatible interfaces to work together seamlessly. ● If we intend to reuse existing code with different interfaces in multiple contexts. ● Standardize access to various database systems with their unique APIs. ● Interact with devices having different communication protocols through a common interface.
  • 15. When to use Decorator pattern? ● Dynamically enhance object behavior at runtime ● GUI component customization using decorators without changing the component itself ● Extending Functionality using filters, interceptors etc ● Build modular and easily extendable middleware
  • 16. When to use Strategy pattern? ● Integrate with different payment gateways via interchangeable strategy objects. ● Different sorting algorithms (mergesort, quicksort) based on user preference. ● Isolate different data access strategies (e.g., JDBC, ORM) behind a common interface for easier switching. ● Implement various logging strategies for different environments (dev, prod). ● We need to extend the system's functionality without breaking existing clients.
  • 17. When to use State pattern? ● The shopping cart can be in different states like "Empty", "Items Added", "Checkout Started", "Payment Completed". ● Based user roles, states like "Logged Out", "Regular User", "Admin" can dynamically limit different functionality. ● When we have workflow states like "Submitted", "In Review", "Approved", "Rejected" ● System and Component Life Cycles
  • 18. Design Pattern usage in Address Forms The official class syntax is currently not part of the core React library. In our address form, we tried to use the concepts of multiple design patterns. ● Strategy Pattern ● Decorator pattern ● State pattern
  • 19. Decorator Pattern in Address Forms
  • 20. Strategy Pattern in Address Forms
  翻译: