SlideShare a Scribd company logo
1 of 14
Download to read offline
Understanding design
patterns fundamentals
Raquel Pau - WalkMod
When we do not use design patterns...
We need to add extra hours to modify features
We need to add extra hours to make test work
We have technical debt
Given When Then for Patterns
Given
an existing source code
When
I need to add a new feature X
Then
I do not need to modify
NOTHING
OPEN-CLOSE PRINCIPLE
Extensibility Metrics
u Coupling:
uHow many components are we using?
u Cohesion:
uHow many responsibilities this component
has?
But usually more components implies more responsibilities
Tools:
u Static Code Analysis Tools
u Coupling:
u To detect duplicated code
u To detect dead code
u To detect excessively referenced components
u Cohesion:
u Number of methods / fields of a component
u Modeling Language Tools to discuss architectures
u UML class diagrams
u UML sequence diagrams
Conway’s law:
interfaces are similar communication
channels between companies
and we have communication patterns, right?
everything consists of using interfaces
u Interfaces isolates definitions from implementations
u Please, delegate work! (Demeter’s law):
u Delegate the maximum work to the specialized components
u The most common interface usage scenarios are called design
patterns.
u Having clear and uniform architectures could allow generating
code when new domain entities need to be added.
Design Pattern Categories
u Architectural/Application patterns
u Gang of Four patterns
u Creational
u Structural
u Behavioural
u Concurrency patterns
Architectural / Application patterns
u Inversion of Control
u Front Controller
u Interceptor Controller
u Data Access Object
u Data Transfer Object
u ...
and application frameworks usually implement most of them
Gang of Four Patterns
u Creational Design Patterns
u Singleton, Factory, Builder, Object Pool
u Behavioural Design Patterns
u Chain of Responsibility, Command, Iterator, Observer,
Facade, Strategy, Template, Visitor, ...
u Structural Design Patterns
u Adapter, Decorator, Bridge, Proxy, ...
most of them are domain driven strategies
Concurrency Patterns
u Scheduler
u Thread Pool
u Thread Local Storage
u Event-based asynchronous
u ...
Applying design patterns on legacy code
u Keep calm:
u It is impossible to predict all the future changes of a software
u Over engineering risk.
u Algorithm:
u Add test coverage if it is missing for legacy code first.
u Refactor existing code with the desired patterns afterwards.
Programming languages and Patterns
u Motivation of a programming language:
u Do more in less code
u Resolve specific performance/concurrency problem
u Write less do not always mean be more readable or
reusable
u Functional programming
Exercise
https://github.com/rpau/designpatterns

More Related Content

What's hot

Complete Programming
Complete ProgrammingComplete Programming
Complete Programminglichtkind
 
Documenting code yapceu2016
Documenting code yapceu2016Documenting code yapceu2016
Documenting code yapceu2016Søren Lund
 
Track code quality with SonarQube - short version
Track code quality with SonarQube - short versionTrack code quality with SonarQube - short version
Track code quality with SonarQube - short versionDmytro Patserkovskyi
 
Collaborative modeling and metamodeling in MetaEdit+
Collaborative modeling and metamodeling in MetaEdit+Collaborative modeling and metamodeling in MetaEdit+
Collaborative modeling and metamodeling in MetaEdit+Juha-Pekka Tolvanen
 
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaTech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaNexus FrontierTech
 
MATLAB Expert Help Research Ideas
MATLAB Expert Help Research IdeasMATLAB Expert Help Research Ideas
MATLAB Expert Help Research IdeasMatlab Simulation
 
Automated Testing DITA Content and Customizations
Automated Testing DITA Content and CustomizationsAutomated Testing DITA Content and Customizations
Automated Testing DITA Content and CustomizationsSteve Anderson
 
Data Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolData Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolIvan Ruchkin
 
Finding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCopFinding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCopCoverity
 
Low code for test automation, state of the art
Low code for test automation, state of the artLow code for test automation, state of the art
Low code for test automation, state of the artFederico Toledo
 
Achieving quality with tools case study
Achieving quality with tools case studyAchieving quality with tools case study
Achieving quality with tools case studyEosSoftware
 
Testing strategies for legacy code
Testing strategies for legacy codeTesting strategies for legacy code
Testing strategies for legacy codeAlex Soto
 
Freddie Mac Internship Overview
Freddie Mac Internship OverviewFreddie Mac Internship Overview
Freddie Mac Internship OverviewCharles Stolze
 
Code Review tool for personal effectiveness and waste analysis
Code Review tool for personal effectiveness and waste analysisCode Review tool for personal effectiveness and waste analysis
Code Review tool for personal effectiveness and waste analysisMikalai Alimenkou
 
C# 4.0 and .NET 4.0
C# 4.0 and .NET 4.0C# 4.0 and .NET 4.0
C# 4.0 and .NET 4.0Buu Nguyen
 

What's hot (20)

Sonar Overview
Sonar OverviewSonar Overview
Sonar Overview
 
Complete Programming
Complete ProgrammingComplete Programming
Complete Programming
 
Documenting code yapceu2016
Documenting code yapceu2016Documenting code yapceu2016
Documenting code yapceu2016
 
Track code quality with SonarQube - short version
Track code quality with SonarQube - short versionTrack code quality with SonarQube - short version
Track code quality with SonarQube - short version
 
C c++ developer jd
C c++ developer jdC c++ developer jd
C c++ developer jd
 
Collaborative modeling and metamodeling in MetaEdit+
Collaborative modeling and metamodeling in MetaEdit+Collaborative modeling and metamodeling in MetaEdit+
Collaborative modeling and metamodeling in MetaEdit+
 
Do Bugs Reside in Complex Code?
Do Bugs Reside in Complex Code?Do Bugs Reside in Complex Code?
Do Bugs Reside in Complex Code?
 
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng NghĩaTech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
Tech Talk #5 : Code Analysis SonarQube - Lương Trọng Nghĩa
 
MATLAB Expert Help Research Ideas
MATLAB Expert Help Research IdeasMATLAB Expert Help Research Ideas
MATLAB Expert Help Research Ideas
 
Automated Testing DITA Content and Customizations
Automated Testing DITA Content and CustomizationsAutomated Testing DITA Content and Customizations
Automated Testing DITA Content and Customizations
 
Sonar Metrics
Sonar MetricsSonar Metrics
Sonar Metrics
 
Data Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolData Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification Tool
 
Finding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCopFinding Defects in C#: Coverity vs. FxCop
Finding Defects in C#: Coverity vs. FxCop
 
Low code for test automation, state of the art
Low code for test automation, state of the artLow code for test automation, state of the art
Low code for test automation, state of the art
 
Achieving quality with tools case study
Achieving quality with tools case studyAchieving quality with tools case study
Achieving quality with tools case study
 
Testing strategies for legacy code
Testing strategies for legacy codeTesting strategies for legacy code
Testing strategies for legacy code
 
Freddie Mac Internship Overview
Freddie Mac Internship OverviewFreddie Mac Internship Overview
Freddie Mac Internship Overview
 
Code Review tool for personal effectiveness and waste analysis
Code Review tool for personal effectiveness and waste analysisCode Review tool for personal effectiveness and waste analysis
Code Review tool for personal effectiveness and waste analysis
 
Turpentine OSS
Turpentine OSSTurpentine OSS
Turpentine OSS
 
C# 4.0 and .NET 4.0
C# 4.0 and .NET 4.0C# 4.0 and .NET 4.0
C# 4.0 and .NET 4.0
 

Viewers also liked

Sonar rules in action with walkmod
Sonar rules in action with walkmodSonar rules in action with walkmod
Sonar rules in action with walkmodRaquel Pau
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talkwalkmod
 
BarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationsBarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationswalkmod
 
walkmod: how it works
walkmod: how it workswalkmod: how it works
walkmod: how it workswalkmod
 
Controlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous DeliveryControlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous Deliverywalkmod
 

Viewers also liked (7)

Sonar rules in action with walkmod
Sonar rules in action with walkmodSonar rules in action with walkmod
Sonar rules in action with walkmod
 
Concurrency patterns
Concurrency patternsConcurrency patterns
Concurrency patterns
 
Concurrency Patterns
Concurrency PatternsConcurrency Patterns
Concurrency Patterns
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
 
BarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationsBarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformations
 
walkmod: how it works
walkmod: how it workswalkmod: how it works
walkmod: how it works
 
Controlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous DeliveryControlling Technical Debt with Continuous Delivery
Controlling Technical Debt with Continuous Delivery
 

Similar to Design Patterns

Designing Object Oriented Software - lecture slides 2013
Designing Object Oriented Software - lecture slides 2013Designing Object Oriented Software - lecture slides 2013
Designing Object Oriented Software - lecture slides 2013Jouni Smed
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementationthe_wumberlog
 
Architecture in action 01
Architecture in action 01Architecture in action 01
Architecture in action 01Krishna Sankar
 
Architecting apps - Can we write better code by planning ahead?
Architecting apps - Can we write better code by planning ahead?Architecting apps - Can we write better code by planning ahead?
Architecting apps - Can we write better code by planning ahead?Paul Ardeleanu
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleikram_ahamed
 
iOS development best practices
iOS development best practicesiOS development best practices
iOS development best practicesMichal Juhas
 
A year of SonarQube and TFS/VSTS
A year of SonarQube and TFS/VSTSA year of SonarQube and TFS/VSTS
A year of SonarQube and TFS/VSTSMatteo Emili
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
 
Adapter design-pattern2015
Adapter design-pattern2015Adapter design-pattern2015
Adapter design-pattern2015Vic Tarchenko
 
Quality and the "Secret Mission:" From End-Stage Tester to Skilled Analyst
Quality and the "Secret Mission:" From End-Stage Tester to Skilled AnalystQuality and the "Secret Mission:" From End-Stage Tester to Skilled Analyst
Quality and the "Secret Mission:" From End-Stage Tester to Skilled AnalystDevorah Firestone
 
Software Development and Quality
Software Development and QualitySoftware Development and Quality
Software Development and QualityHerwig Habenbacher
 
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflowMay 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflowAdam Doyle
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studioDerek Kane
 

Similar to Design Patterns (20)

010821+presentation+oti.ppt
010821+presentation+oti.ppt010821+presentation+oti.ppt
010821+presentation+oti.ppt
 
Designing Object Oriented Software - lecture slides 2013
Designing Object Oriented Software - lecture slides 2013Designing Object Oriented Software - lecture slides 2013
Designing Object Oriented Software - lecture slides 2013
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
Architecture in action 01
Architecture in action 01Architecture in action 01
Architecture in action 01
 
L05 Design Patterns
L05 Design PatternsL05 Design Patterns
L05 Design Patterns
 
L03 Design Patterns
L03 Design PatternsL03 Design Patterns
L03 Design Patterns
 
Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)
 
Architecting apps - Can we write better code by planning ahead?
Architecting apps - Can we write better code by planning ahead?Architecting apps - Can we write better code by planning ahead?
Architecting apps - Can we write better code by planning ahead?
 
NEXiDA at OMG June 2009
NEXiDA at OMG June 2009NEXiDA at OMG June 2009
NEXiDA at OMG June 2009
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
iOS development best practices
iOS development best practicesiOS development best practices
iOS development best practices
 
A year of SonarQube and TFS/VSTS
A year of SonarQube and TFS/VSTSA year of SonarQube and TFS/VSTS
A year of SonarQube and TFS/VSTS
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Adapter design-pattern2015
Adapter design-pattern2015Adapter design-pattern2015
Adapter design-pattern2015
 
Quality and the "Secret Mission:" From End-Stage Tester to Skilled Analyst
Quality and the "Secret Mission:" From End-Stage Tester to Skilled AnalystQuality and the "Secret Mission:" From End-Stage Tester to Skilled Analyst
Quality and the "Secret Mission:" From End-Stage Tester to Skilled Analyst
 
Software Development and Quality
Software Development and QualitySoftware Development and Quality
Software Development and Quality
 
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflowMay 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studio
 
L05 Design Patterns
L05 Design PatternsL05 Design Patterns
L05 Design Patterns
 

Recently uploaded

Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 

Recently uploaded (20)

Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 

Design Patterns

  • 2. When we do not use design patterns... We need to add extra hours to modify features We need to add extra hours to make test work We have technical debt
  • 3. Given When Then for Patterns Given an existing source code When I need to add a new feature X Then I do not need to modify NOTHING OPEN-CLOSE PRINCIPLE
  • 4. Extensibility Metrics u Coupling: uHow many components are we using? u Cohesion: uHow many responsibilities this component has? But usually more components implies more responsibilities
  • 5. Tools: u Static Code Analysis Tools u Coupling: u To detect duplicated code u To detect dead code u To detect excessively referenced components u Cohesion: u Number of methods / fields of a component u Modeling Language Tools to discuss architectures u UML class diagrams u UML sequence diagrams
  • 6. Conway’s law: interfaces are similar communication channels between companies and we have communication patterns, right?
  • 7. everything consists of using interfaces u Interfaces isolates definitions from implementations u Please, delegate work! (Demeter’s law): u Delegate the maximum work to the specialized components u The most common interface usage scenarios are called design patterns. u Having clear and uniform architectures could allow generating code when new domain entities need to be added.
  • 8. Design Pattern Categories u Architectural/Application patterns u Gang of Four patterns u Creational u Structural u Behavioural u Concurrency patterns
  • 9. Architectural / Application patterns u Inversion of Control u Front Controller u Interceptor Controller u Data Access Object u Data Transfer Object u ... and application frameworks usually implement most of them
  • 10. Gang of Four Patterns u Creational Design Patterns u Singleton, Factory, Builder, Object Pool u Behavioural Design Patterns u Chain of Responsibility, Command, Iterator, Observer, Facade, Strategy, Template, Visitor, ... u Structural Design Patterns u Adapter, Decorator, Bridge, Proxy, ... most of them are domain driven strategies
  • 11. Concurrency Patterns u Scheduler u Thread Pool u Thread Local Storage u Event-based asynchronous u ...
  • 12. Applying design patterns on legacy code u Keep calm: u It is impossible to predict all the future changes of a software u Over engineering risk. u Algorithm: u Add test coverage if it is missing for legacy code first. u Refactor existing code with the desired patterns afterwards.
  • 13. Programming languages and Patterns u Motivation of a programming language: u Do more in less code u Resolve specific performance/concurrency problem u Write less do not always mean be more readable or reusable u Functional programming