SlideShare une entreprise Scribd logo
1  sur  28
Design Patterns
How to include them in
existing code
/Studio
Architecture
• Wikipedia
– The software architecture of a program or
computing system is the structure or structures of
the system, which comprise software
components, the externally visible properties of
those components, and the relationships between
them.
Architecture defined - Decision
• Software architecture encompasses the set of significant
decisions about the organization of a software system
– Selection of the structural elements and their interfaces by
which a system is composed
– Behavior as specified in collaborations among those elements
– Composition of these structural and behavioral elements into
larger subsystems
– Architectural style that guides this organization
Booch, Kruchten, Reitman,
Bittner, and Shaw
Architecture defined - Irreversibility
• Architecture establishes the irreversible
context for design and implementation
architecture
CODE
implementation
design
Architectural
decisions are the
most fundamental
decisions; changing
them will have
significant ripple
effects because they
are hard to reverse
Architect defined - Irreversibility
• Architect’s most important tasks is to remove
architecture by finding ways to eliminate
irreversibility in software designs
Martin Fowler
Design challenges
• Design is non-deterministic
– Not a repeatable processes that are guaranteed to produce
predictable results
• Design techniques tend to be “heuristics”
– “rules of thumb”
– “things to try that sometimes work”
• Design is an iterative process
– Sloppy process
– About trade-offs and priorities
– Involves trial and error
Fundamentals heuristics
• Crisp abstractions
– Keep Your Design Modular
– Aim for Strong Cohesion
• Clear Separation of Concerns
– Stratification
• Accommodate human cognitive limitations
• Balanced distribution of responsibilities
– Find Behavior and Real-World Objects
• Keep Coupling Loose
– Hold connections among different parts to a minimum
– Formalize Class Contracts
– Encapsulate Implementation Details
Fundamentals heuristics
• Choose simple solution
– No extra parts (TDD enforce this)
– Avoid Failure
– Consider Using Brute Force
• Design for Test
• Identify Areas Likely to Change
– Extensibility, Plugins, IOC, DI
• Look for proven solution
– Patterns
Patterns defined
• A pattern is a proven solution to a common and
recurring problem
• A pattern codifies specific knowledge collected from
experience in a domain
• A pattern resolves forces in context
• All well-structured systems are full of patterns
•http://www.hillside.net
Patterns raise the level of abstraction
• For a developer the standard design elements are
objects
– Everything is an object
• For an architect the standard design elements are
patterns
Patterns creates a vocabulary
• “Everything is an object” is like an architect
summing up a house by saying “Everything is a
room”
– Big room with high voltage outlets and a sink to
cook
– Small room upstairs to sleep
• Room follow patterns and special names are
created to describe it
– Kitchen
– Bedroom
Patterns simplifies communication
• It enables packing a huge amount of information
into a short sentence
– Three-bedroom, two-bath house with an open-plan
kitchen
Patterns are proven solutions
• Not all combinations of design elements are
practical
• Bedroom and bathroom are separated
– Bathrooms have specialized and expensive
infrastructure requirements
– Bathroom require maximum privacy while
bedroom can be share
• Bathtub and toilet end up in the same room
– Both require the same infrastructure
Patterns avoid silly mistake
• Putting a toilet next to a refrigerator
• Putting dishwasher next to a bathtubs
Patterns and software design
• Starting in the 1990s software patterns were
applied in many ways with success
– Design Patterrns (Gang of four 1994)
– Enterprise architecture (Fowler 2002)
Layered Architecture
• Common technique to break apart
complicated software system into
partition in which each partition is at a
particular level of abstraction
• A layer is a cohesive and tightly
coupled partition that depends only
on the layers below
• The most simple but also the most
important enterprise application
patterns
• The hardest part of a layered
architecture is deciding what layers to
have and what the responsibilities of
each layer should be
Presentation
Infrastructure
Layers
Domain Logic
Patterns
• Use Factories to delegate the production of
objects.
• Use Decorators to avoid hierarchy explosion.
• Use Proxies to control access to objects.
• Use Strategies to pass algorithms to objects.
• Use Commands to pass requests to objects.
• Use Template Method to delegate parts of an
algorithm
• Use the Composite Pattern to treat objects and
collections uniformly.
Use Factories to delegate the production of objects.
Use Decorators to avoid hierarchy explosion
Use Proxies to control access to objects
Use Strategies to pass algorithms to objects
Use Commands to pass requests to objects
Use Template Method to delegate part of an algorithm
Use the Composite Pattern to treat objects and collections uniformly
Complexity
0
1
0 1 2 3 4 5 6
Local
Complexity
Abstraction level
Complexity
0
1
0 1 2 3 4 5 6
Local
Global
Complexity
Abstraction level
Confort zone
• Transform code to use patterns
DEMO
The end
• Remember
– Pattern for common naming
– Pattern to solve well known problem
– Watch out for complexity
• Eric De Carufel
– eric@decarufel.net
– http://blog.decarufel.net
– http://pyxis-tech.com
• Questions?
28

Contenu connexe

En vedette

Big refactoring #12
Big refactoring #12Big refactoring #12
Big refactoring #12Jay Kim
 
TDD&Refactoring Day 01: Refactoring
TDD&Refactoring Day 01: RefactoringTDD&Refactoring Day 01: Refactoring
TDD&Refactoring Day 01: RefactoringSuwon Chae
 
[NEXT] Nextgram Refactoring
[NEXT] Nextgram Refactoring[NEXT] Nextgram Refactoring
[NEXT] Nextgram RefactoringYoungSu Son
 
Refactoring tutorial
Refactoring tutorialRefactoring tutorial
Refactoring tutorialBingu Shim
 
Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]bbongcsu
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Wim Godden
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websocketsWim Godden
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHPRob Knight
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developersWim Godden
 
The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017Christian Heilmann
 
The Soul in The Machine - Developing for Humans
The Soul in The Machine - Developing for HumansThe Soul in The Machine - Developing for Humans
The Soul in The Machine - Developing for HumansChristian Heilmann
 

En vedette (11)

Big refactoring #12
Big refactoring #12Big refactoring #12
Big refactoring #12
 
TDD&Refactoring Day 01: Refactoring
TDD&Refactoring Day 01: RefactoringTDD&Refactoring Day 01: Refactoring
TDD&Refactoring Day 01: Refactoring
 
[NEXT] Nextgram Refactoring
[NEXT] Nextgram Refactoring[NEXT] Nextgram Refactoring
[NEXT] Nextgram Refactoring
 
Refactoring tutorial
Refactoring tutorialRefactoring tutorial
Refactoring tutorial
 
Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]Refactoring tutorial 1주차[refactoring 개요]
Refactoring tutorial 1주차[refactoring 개요]
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHP
 
Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017
 
The Soul in The Machine - Developing for Humans
The Soul in The Machine - Developing for HumansThe Soul in The Machine - Developing for Humans
The Soul in The Machine - Developing for Humans
 

Similaire à Refactoring to Design Patterns

Similaire à Refactoring to Design Patterns (20)

Software Design Concepts
Software Design ConceptsSoftware Design Concepts
Software Design Concepts
 
Unit 5 design engineering ssad
Unit 5 design engineering ssadUnit 5 design engineering ssad
Unit 5 design engineering ssad
 
Chapter 6 design
Chapter 6 designChapter 6 design
Chapter 6 design
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Patterns
PatternsPatterns
Patterns
 
Designing and documenting software architecture unit 5
Designing and documenting software architecture unit 5Designing and documenting software architecture unit 5
Designing and documenting software architecture unit 5
 
Software architecture 4
Software architecture 4Software architecture 4
Software architecture 4
 
Analysis
AnalysisAnalysis
Analysis
 
unit 3 Design 1
unit 3 Design 1unit 3 Design 1
unit 3 Design 1
 
UNIT-4design-concepts-se-pressman-ppt.PPT
UNIT-4design-concepts-se-pressman-ppt.PPTUNIT-4design-concepts-se-pressman-ppt.PPT
UNIT-4design-concepts-se-pressman-ppt.PPT
 
11.ppt
11.ppt11.ppt
11.ppt
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptx
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptx
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Architecture in action 01
Architecture in action 01Architecture in action 01
Architecture in action 01
 
Good Slides on Architecture.ppt
Good Slides on Architecture.pptGood Slides on Architecture.ppt
Good Slides on Architecture.ppt
 
Design pattern
Design patternDesign pattern
Design pattern
 
Software Design - SDLC Model
Software Design - SDLC ModelSoftware Design - SDLC Model
Software Design - SDLC Model
 
Design engineering
Design engineeringDesign engineering
Design engineering
 

Plus de Eric De Carufel

Bracket Show Episode 35 - histoire de c# de 2002 à 2019
Bracket Show Episode 35 - histoire de c# de 2002 à 2019Bracket Show Episode 35 - histoire de c# de 2002 à 2019
Bracket Show Episode 35 - histoire de c# de 2002 à 2019Eric De Carufel
 
Architecture azure performante
Architecture azure performanteArchitecture azure performante
Architecture azure performanteEric De Carufel
 
Cqrs + event sourcing pyxis v2 - en
Cqrs + event sourcing   pyxis v2 - enCqrs + event sourcing   pyxis v2 - en
Cqrs + event sourcing pyxis v2 - enEric De Carufel
 
Top 5 des meilleures façons d'améliorer votre code
Top 5 des meilleures façons d'améliorer votre codeTop 5 des meilleures façons d'améliorer votre code
Top 5 des meilleures façons d'améliorer votre codeEric De Carufel
 
Dvcs mercurial - pyxis - eric de carufel
Dvcs   mercurial - pyxis - eric de carufelDvcs   mercurial - pyxis - eric de carufel
Dvcs mercurial - pyxis - eric de carufelEric De Carufel
 
Top 5 des meilleures façon d'améliorer ton code
Top 5 des meilleures façon d'améliorer ton codeTop 5 des meilleures façon d'améliorer ton code
Top 5 des meilleures façon d'améliorer ton codeEric De Carufel
 

Plus de Eric De Carufel (8)

Bracket Show Episode 35 - histoire de c# de 2002 à 2019
Bracket Show Episode 35 - histoire de c# de 2002 à 2019Bracket Show Episode 35 - histoire de c# de 2002 à 2019
Bracket Show Episode 35 - histoire de c# de 2002 à 2019
 
Gadgteteer clean code
Gadgteteer   clean codeGadgteteer   clean code
Gadgteteer clean code
 
Architecture azure performante
Architecture azure performanteArchitecture azure performante
Architecture azure performante
 
Cqrs + event sourcing pyxis v2 - en
Cqrs + event sourcing   pyxis v2 - enCqrs + event sourcing   pyxis v2 - en
Cqrs + event sourcing pyxis v2 - en
 
Top 5 des meilleures façons d'améliorer votre code
Top 5 des meilleures façons d'améliorer votre codeTop 5 des meilleures façons d'améliorer votre code
Top 5 des meilleures façons d'améliorer votre code
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
 
Dvcs mercurial - pyxis - eric de carufel
Dvcs   mercurial - pyxis - eric de carufelDvcs   mercurial - pyxis - eric de carufel
Dvcs mercurial - pyxis - eric de carufel
 
Top 5 des meilleures façon d'améliorer ton code
Top 5 des meilleures façon d'améliorer ton codeTop 5 des meilleures façon d'améliorer ton code
Top 5 des meilleures façon d'améliorer ton code
 

Dernier

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Dernier (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

Refactoring to Design Patterns

  • 1. Design Patterns How to include them in existing code /Studio
  • 2. Architecture • Wikipedia – The software architecture of a program or computing system is the structure or structures of the system, which comprise software components, the externally visible properties of those components, and the relationships between them.
  • 3. Architecture defined - Decision • Software architecture encompasses the set of significant decisions about the organization of a software system – Selection of the structural elements and their interfaces by which a system is composed – Behavior as specified in collaborations among those elements – Composition of these structural and behavioral elements into larger subsystems – Architectural style that guides this organization Booch, Kruchten, Reitman, Bittner, and Shaw
  • 4. Architecture defined - Irreversibility • Architecture establishes the irreversible context for design and implementation architecture CODE implementation design Architectural decisions are the most fundamental decisions; changing them will have significant ripple effects because they are hard to reverse
  • 5. Architect defined - Irreversibility • Architect’s most important tasks is to remove architecture by finding ways to eliminate irreversibility in software designs Martin Fowler
  • 6. Design challenges • Design is non-deterministic – Not a repeatable processes that are guaranteed to produce predictable results • Design techniques tend to be “heuristics” – “rules of thumb” – “things to try that sometimes work” • Design is an iterative process – Sloppy process – About trade-offs and priorities – Involves trial and error
  • 7. Fundamentals heuristics • Crisp abstractions – Keep Your Design Modular – Aim for Strong Cohesion • Clear Separation of Concerns – Stratification • Accommodate human cognitive limitations • Balanced distribution of responsibilities – Find Behavior and Real-World Objects • Keep Coupling Loose – Hold connections among different parts to a minimum – Formalize Class Contracts – Encapsulate Implementation Details
  • 8. Fundamentals heuristics • Choose simple solution – No extra parts (TDD enforce this) – Avoid Failure – Consider Using Brute Force • Design for Test • Identify Areas Likely to Change – Extensibility, Plugins, IOC, DI • Look for proven solution – Patterns
  • 9. Patterns defined • A pattern is a proven solution to a common and recurring problem • A pattern codifies specific knowledge collected from experience in a domain • A pattern resolves forces in context • All well-structured systems are full of patterns •http://www.hillside.net
  • 10. Patterns raise the level of abstraction • For a developer the standard design elements are objects – Everything is an object • For an architect the standard design elements are patterns
  • 11. Patterns creates a vocabulary • “Everything is an object” is like an architect summing up a house by saying “Everything is a room” – Big room with high voltage outlets and a sink to cook – Small room upstairs to sleep • Room follow patterns and special names are created to describe it – Kitchen – Bedroom
  • 12. Patterns simplifies communication • It enables packing a huge amount of information into a short sentence – Three-bedroom, two-bath house with an open-plan kitchen
  • 13. Patterns are proven solutions • Not all combinations of design elements are practical • Bedroom and bathroom are separated – Bathrooms have specialized and expensive infrastructure requirements – Bathroom require maximum privacy while bedroom can be share • Bathtub and toilet end up in the same room – Both require the same infrastructure
  • 14. Patterns avoid silly mistake • Putting a toilet next to a refrigerator • Putting dishwasher next to a bathtubs
  • 15. Patterns and software design • Starting in the 1990s software patterns were applied in many ways with success – Design Patterrns (Gang of four 1994) – Enterprise architecture (Fowler 2002)
  • 16. Layered Architecture • Common technique to break apart complicated software system into partition in which each partition is at a particular level of abstraction • A layer is a cohesive and tightly coupled partition that depends only on the layers below • The most simple but also the most important enterprise application patterns • The hardest part of a layered architecture is deciding what layers to have and what the responsibilities of each layer should be Presentation Infrastructure Layers Domain Logic
  • 17. Patterns • Use Factories to delegate the production of objects. • Use Decorators to avoid hierarchy explosion. • Use Proxies to control access to objects. • Use Strategies to pass algorithms to objects. • Use Commands to pass requests to objects. • Use Template Method to delegate parts of an algorithm • Use the Composite Pattern to treat objects and collections uniformly.
  • 18. Use Factories to delegate the production of objects.
  • 19. Use Decorators to avoid hierarchy explosion
  • 20. Use Proxies to control access to objects
  • 21. Use Strategies to pass algorithms to objects
  • 22. Use Commands to pass requests to objects
  • 23. Use Template Method to delegate part of an algorithm
  • 24. Use the Composite Pattern to treat objects and collections uniformly
  • 25. Complexity 0 1 0 1 2 3 4 5 6 Local Complexity Abstraction level
  • 26. Complexity 0 1 0 1 2 3 4 5 6 Local Global Complexity Abstraction level Confort zone
  • 27. • Transform code to use patterns DEMO
  • 28. The end • Remember – Pattern for common naming – Pattern to solve well known problem – Watch out for complexity • Eric De Carufel – eric@decarufel.net – http://blog.decarufel.net – http://pyxis-tech.com • Questions? 28