SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

Destacado

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
 

Destacado (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
 

Similar a Refactoring to Design Patterns

Similar a 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
 

Más 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
 

Más 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
 

Último

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 

Último (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 

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