SlideShare a Scribd company logo
1 of 23
Download to read offline
Introduction to Design PatternsIntroduction to Design Patterns
João Miguel Pereira
http://jpereira.eu
M 2012May 2012
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative Commons Attribution‐NonCommercial‐ShareAlike
3.0 Unported License.
Introduction to Design PatternsIntroduction to Design Patterns
• What is a patternWhat is a pattern
• Architecture Patterns
i• Design Patterns
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
2
Introduction to Design PatternsIntroduction to Design Patterns
• What is a PatternWhat is a Pattern
• Architecture Patterns
i• Design Patterns
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
3
What is a PatternWhat is a Pattern
“It can be a template or model which can be used to generate things 
or parts of a thing, especially if the things that are created have 
enough in common for the underlying pattern to be inferred, in which enough in common for the underlying pattern to be inferred, in which
case the things are said to exhibit the unique pattern.“ ‐
http://en.wikipedia.org/wiki/Pattern
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
4
What is a Pattern
In construction of towns and building
"Each pattern describes a problem which occurs over and over again in our 
environment, and then describes the core of the solution to that problem, in such a 
h hi l i illi i i h d i i hway that you can use this solution a million times over, without ever doing it the 
same way twice” ‐‐ Christopher Alexander, Sara Ishikawa, Murray Silverstein, Max Jacobson, Ingrid Fiksdahl‐King, 
and Shlomo Angel. A Pattern Language. Oxford University Press, New York, 1977. 
fl lfl lInfluential in 
Software design 
patterns
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
5
Christopher Alexander
What is a Pattern
In construction of Software
“Our solutions are expressed in terms of objects and interfaces instead of walls and 
doors, but at the core of both kinds of patterns is a solution to a problem in a doo s, but at t e co e o bot ds o patte s s a so ut o to a p ob e a
context.” – Eric Gamma, et.al. Design patterns : elements of reusable object‐oriented software
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
6
Christopher Alexander
Eric Gamma
What is a Pattern
Essential Elements of a Pattern
• Name  Use it in our design vocabularyName  Use it in our design vocabulary
• Problem  Explain the problem and the context.
S l i• Solution  Describes the elements that make up the 
design, their relationships, responsibilities, and 
collaborationscollaborations. 
• Consequences  The results and trade‐offs of applying 
the patternthe pattern .
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
7
Christopher Alexander
What is a pattern
Abstraction in Software Design Patterns
Abstract
Architecture patterns
FocusFocus
Design patterns
Details
Focus
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
8
Introduction to Design PatternsIntroduction to Design Patterns
• What is a Design PatternWhat is a Design Pattern
• Architecture Patterns
i• Design Patterns
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
9
Architecture PatternsArchitecture Patterns
• A fundamental structural organization schemaA fundamental structural organization schema 
for software systems.
• Provides predefined subsystems and their• Provides predefined subsystems and their 
responsibilities
Gi l f i i h l i hi• Give rules for organizing the relationships 
between these sub systems
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
10
Architecture PatternsArchitecture Patterns
• Architecture pattern example: LayersArchitecture pattern example: Layers
– Helps to structure applications that can be 
decomposed into groups of subtasks in whichdecomposed into groups of subtasks in which 
each group of subtasks is at a particular level of 
abstraction
Presentation Layer
Domain/Business Layer
Data Layer
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
11
y
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Pipes & FiltersArchitecture pattern example: Pipes & Filters
– Help to structure systems that process a stream of 
datadata. 
JSON Filter
Data 
Extractor 
Filter
Data 
Normalizer
Data 
Storage 
Filter
Internet Publisher 
Filter
JSON Filter
XML Filter
HTML Filter
Data
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
12
ata
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Blackboardc tectu e patte e a p e: ac boa d
– Several specialized subsystems assemble their 
knowledge to build a possibly partial or approximate 
l tisolution.
– Useful for problems for which no deterministic 
solution strategies are known.g
CRM 
S t
Inventory
S t
Financial
System
Delivery
System System SystemSystem
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
13
Enterprise Service Bus (EX: Service Mix)
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Model ViewArchitecture pattern example: Model View 
Controller
– Splits the application into separate layers (Using– Splits the application into separate layers (Using 
Layers Pattern)
Presentation Layer
Model LayerModel Layer
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
14
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Model ViewArchitecture pattern example: Model View 
Controller
– Presentation layer is further split into View and– Presentation layer is further split into View and 
Controller
Presentation Layer
View Layer
Controller Layer
Model Layer
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
15
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Model ViewArchitecture pattern example: Model View 
Controller
– Each layer is assigned a set of responsibilities– Each layer is assigned a set of responsibilities
View Layer
Renders the model into a user interface. 
Can render HTLM, JSON, XML, etc.
View Layer
Controller Layer
Responds to user events and 
may invoke changes on the 
model layer
Model Layer
Controller Layer
Operate on business data, i.e., the 
business Logic.
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
16
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Model ViewArchitecture pattern example: Model View 
Controller
– User events in a Web application are usually an– User events, in a Web application, are usually an 
HTTP Request
HTTP Request1 HTTP Response4
Controller
ModelViews
Render3 Update2
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
17
Architecture PatternsArchitecture Patterns
• Architecture pattern example: Model View Controllerp p
– Many interpretations of the Pattern
– Some web links:
h //h i ifi i / / h / / i d h l• http://heim.ifi.uio.no/~trygver/themes/mvc/mvc‐index.html
• http://martinfowler.com/eaaDev/uiArchs.html
• http://st‐www.cs.illinois.edu/users/smarch/st‐docs/mvc.html
– Some books:
• Patterns of Enterprise Architecture (http://amzn.to/book_PEA )
• Pattern‐Oriented Software Architecture Volume 1: A System of 
Patterns (http://amzn.to/book_POSAV1 )
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
18
Architecture PatternsArchitecture Patterns
• More Architecture Patterns:More Architecture Patterns:
– Patterns of Enterprise Architecture
• http://amzn to/book PEAhttp://amzn.to/book_PEA
– Pattern‐Oriented Software Architecture Volume 1: 
A System of Patterns
• http://amzn.to/book_POSAV1 
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
19
Introduction to Design PatternsIntroduction to Design Patterns
• What is a Design PatternWhat is a Design Pattern
• Architecture Patterns
i• Design Patterns
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
20
Design patternDesign pattern
Framework for thinking and 
d i i OO !designing OO programs!
Reusable knowledge in SoftwareReusable knowledge in Software 
Design!
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
21
Design patternDesign pattern
Java Frameworks for OOKnowledge Framework Java Frameworks for OO 
Development
Knowledge Framework 
for OO Design
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
22
Design Patterns
The Book
http://amzn.to/book_DPEROOS 
Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative 
Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License
23

More Related Content

Similar to Introduction to Design Patterns

Business Value of Social Software
Business Value of Social SoftwareBusiness Value of Social Software
Business Value of Social SoftwareBlue Economy Agency
 
Generation of Automatic Code using Design Patterns
Generation of Automatic Code using Design PatternsGeneration of Automatic Code using Design Patterns
Generation of Automatic Code using Design PatternsIRJET Journal
 
Understanding and Conceptualizing interaction - Mary Margarat
Understanding and Conceptualizing interaction  - Mary MargaratUnderstanding and Conceptualizing interaction  - Mary Margarat
Understanding and Conceptualizing interaction - Mary MargaratMary Margarat
 
Modeling should be an independent scientific discipline
Modeling should be an independent scientific disciplineModeling should be an independent scientific discipline
Modeling should be an independent scientific disciplineJordi Cabot
 
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...Galala University
 
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...Yasser Mahgoub
 
Eugene Lee of SocialText #smo09 London
Eugene Lee of SocialText #smo09 LondonEugene Lee of SocialText #smo09 London
Eugene Lee of SocialText #smo09 LondonArjen Strijker
 
Somesso London 09 Internal Communications Eugene Lee 5 15 09
Somesso London 09 Internal Communications Eugene Lee 5 15 09Somesso London 09 Internal Communications Eugene Lee 5 15 09
Somesso London 09 Internal Communications Eugene Lee 5 15 09Eugene Lee
 
From project to product mindset and onwards to product platform architectures
From project to product mindset and onwards to product platform architecturesFrom project to product mindset and onwards to product platform architectures
From project to product mindset and onwards to product platform architecturesJorn Bettin
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2Ankit Dubey
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaEdureka!
 
The original 'Double Diamond' design methodbank
The original 'Double Diamond' design methodbank The original 'Double Diamond' design methodbank
The original 'Double Diamond' design methodbank Andrea Cooper
 
Search & Discovery Patterns, a UIE Virtual Seminar
Search & Discovery Patterns, a UIE Virtual SeminarSearch & Discovery Patterns, a UIE Virtual Seminar
Search & Discovery Patterns, a UIE Virtual SeminarUIEpreviews
 
Introduction to Participatory Pattern Workshops
Introduction to Participatory Pattern WorkshopsIntroduction to Participatory Pattern Workshops
Introduction to Participatory Pattern WorkshopsYishay Mor
 

Similar to Introduction to Design Patterns (20)

Business Value of Social Software
Business Value of Social SoftwareBusiness Value of Social Software
Business Value of Social Software
 
IDT Module 1 NOTES.pptx
IDT Module 1 NOTES.pptxIDT Module 1 NOTES.pptx
IDT Module 1 NOTES.pptx
 
010821+presentation+oti.ppt
010821+presentation+oti.ppt010821+presentation+oti.ppt
010821+presentation+oti.ppt
 
Generation of Automatic Code using Design Patterns
Generation of Automatic Code using Design PatternsGeneration of Automatic Code using Design Patterns
Generation of Automatic Code using Design Patterns
 
Y&R
Y&RY&R
Y&R
 
Understanding and Conceptualizing interaction - Mary Margarat
Understanding and Conceptualizing interaction  - Mary MargaratUnderstanding and Conceptualizing interaction  - Mary Margarat
Understanding and Conceptualizing interaction - Mary Margarat
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Modeling should be an independent scientific discipline
Modeling should be an independent scientific disciplineModeling should be an independent scientific discipline
Modeling should be an independent scientific discipline
 
A Methodology for Building the Internet of Things
A Methodology for Building the Internet of ThingsA Methodology for Building the Internet of Things
A Methodology for Building the Internet of Things
 
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
 
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
AI-Human Dialogue for Architectural Design Concept Generation presentation 26...
 
Eugene Lee of SocialText #smo09 London
Eugene Lee of SocialText #smo09 LondonEugene Lee of SocialText #smo09 London
Eugene Lee of SocialText #smo09 London
 
Somesso London 09 Internal Communications Eugene Lee 5 15 09
Somesso London 09 Internal Communications Eugene Lee 5 15 09Somesso London 09 Internal Communications Eugene Lee 5 15 09
Somesso London 09 Internal Communications Eugene Lee 5 15 09
 
From project to product mindset and onwards to product platform architectures
From project to product mindset and onwards to product platform architecturesFrom project to product mindset and onwards to product platform architectures
From project to product mindset and onwards to product platform architectures
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
Fluid Design Pattern Library
Fluid Design Pattern LibraryFluid Design Pattern Library
Fluid Design Pattern Library
 
The original 'Double Diamond' design methodbank
The original 'Double Diamond' design methodbank The original 'Double Diamond' design methodbank
The original 'Double Diamond' design methodbank
 
Search & Discovery Patterns, a UIE Virtual Seminar
Search & Discovery Patterns, a UIE Virtual SeminarSearch & Discovery Patterns, a UIE Virtual Seminar
Search & Discovery Patterns, a UIE Virtual Seminar
 
Introduction to Participatory Pattern Workshops
Introduction to Participatory Pattern WorkshopsIntroduction to Participatory Pattern Workshops
Introduction to Participatory Pattern Workshops
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

Introduction to Design Patterns

  • 1. Introduction to Design PatternsIntroduction to Design Patterns João Miguel Pereira http://jpereira.eu M 2012May 2012 Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License.
  • 2. Introduction to Design PatternsIntroduction to Design Patterns • What is a patternWhat is a pattern • Architecture Patterns i• Design Patterns Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 2
  • 3. Introduction to Design PatternsIntroduction to Design Patterns • What is a PatternWhat is a Pattern • Architecture Patterns i• Design Patterns Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 3
  • 4. What is a PatternWhat is a Pattern “It can be a template or model which can be used to generate things  or parts of a thing, especially if the things that are created have  enough in common for the underlying pattern to be inferred, in which enough in common for the underlying pattern to be inferred, in which case the things are said to exhibit the unique pattern.“ ‐ http://en.wikipedia.org/wiki/Pattern Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 4
  • 5. What is a Pattern In construction of towns and building "Each pattern describes a problem which occurs over and over again in our  environment, and then describes the core of the solution to that problem, in such a  h hi l i illi i i h d i i hway that you can use this solution a million times over, without ever doing it the  same way twice” ‐‐ Christopher Alexander, Sara Ishikawa, Murray Silverstein, Max Jacobson, Ingrid Fiksdahl‐King,  and Shlomo Angel. A Pattern Language. Oxford University Press, New York, 1977.  fl lfl lInfluential in  Software design  patterns Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 5 Christopher Alexander
  • 6. What is a Pattern In construction of Software “Our solutions are expressed in terms of objects and interfaces instead of walls and  doors, but at the core of both kinds of patterns is a solution to a problem in a doo s, but at t e co e o bot ds o patte s s a so ut o to a p ob e a context.” – Eric Gamma, et.al. Design patterns : elements of reusable object‐oriented software Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 6 Christopher Alexander Eric Gamma
  • 7. What is a Pattern Essential Elements of a Pattern • Name  Use it in our design vocabularyName  Use it in our design vocabulary • Problem  Explain the problem and the context. S l i• Solution  Describes the elements that make up the  design, their relationships, responsibilities, and  collaborationscollaborations.  • Consequences  The results and trade‐offs of applying  the patternthe pattern . Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 7 Christopher Alexander
  • 8. What is a pattern Abstraction in Software Design Patterns Abstract Architecture patterns FocusFocus Design patterns Details Focus Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 8
  • 9. Introduction to Design PatternsIntroduction to Design Patterns • What is a Design PatternWhat is a Design Pattern • Architecture Patterns i• Design Patterns Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 9
  • 10. Architecture PatternsArchitecture Patterns • A fundamental structural organization schemaA fundamental structural organization schema  for software systems. • Provides predefined subsystems and their• Provides predefined subsystems and their  responsibilities Gi l f i i h l i hi• Give rules for organizing the relationships  between these sub systems Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 10
  • 11. Architecture PatternsArchitecture Patterns • Architecture pattern example: LayersArchitecture pattern example: Layers – Helps to structure applications that can be  decomposed into groups of subtasks in whichdecomposed into groups of subtasks in which  each group of subtasks is at a particular level of  abstraction Presentation Layer Domain/Business Layer Data Layer Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 11 y
  • 12. Architecture PatternsArchitecture Patterns • Architecture pattern example: Pipes & FiltersArchitecture pattern example: Pipes & Filters – Help to structure systems that process a stream of  datadata.  JSON Filter Data  Extractor  Filter Data  Normalizer Data  Storage  Filter Internet Publisher  Filter JSON Filter XML Filter HTML Filter Data Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 12 ata
  • 13. Architecture PatternsArchitecture Patterns • Architecture pattern example: Blackboardc tectu e patte e a p e: ac boa d – Several specialized subsystems assemble their  knowledge to build a possibly partial or approximate  l tisolution. – Useful for problems for which no deterministic  solution strategies are known.g CRM  S t Inventory S t Financial System Delivery System System SystemSystem Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 13 Enterprise Service Bus (EX: Service Mix)
  • 14. Architecture PatternsArchitecture Patterns • Architecture pattern example: Model ViewArchitecture pattern example: Model View  Controller – Splits the application into separate layers (Using– Splits the application into separate layers (Using  Layers Pattern) Presentation Layer Model LayerModel Layer Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 14
  • 15. Architecture PatternsArchitecture Patterns • Architecture pattern example: Model ViewArchitecture pattern example: Model View  Controller – Presentation layer is further split into View and– Presentation layer is further split into View and  Controller Presentation Layer View Layer Controller Layer Model Layer Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 15
  • 16. Architecture PatternsArchitecture Patterns • Architecture pattern example: Model ViewArchitecture pattern example: Model View  Controller – Each layer is assigned a set of responsibilities– Each layer is assigned a set of responsibilities View Layer Renders the model into a user interface.  Can render HTLM, JSON, XML, etc. View Layer Controller Layer Responds to user events and  may invoke changes on the  model layer Model Layer Controller Layer Operate on business data, i.e., the  business Logic. Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 16
  • 17. Architecture PatternsArchitecture Patterns • Architecture pattern example: Model ViewArchitecture pattern example: Model View  Controller – User events in a Web application are usually an– User events, in a Web application, are usually an  HTTP Request HTTP Request1 HTTP Response4 Controller ModelViews Render3 Update2 Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 17
  • 18. Architecture PatternsArchitecture Patterns • Architecture pattern example: Model View Controllerp p – Many interpretations of the Pattern – Some web links: h //h i ifi i / / h / / i d h l• http://heim.ifi.uio.no/~trygver/themes/mvc/mvc‐index.html • http://martinfowler.com/eaaDev/uiArchs.html • http://st‐www.cs.illinois.edu/users/smarch/st‐docs/mvc.html – Some books: • Patterns of Enterprise Architecture (http://amzn.to/book_PEA ) • Pattern‐Oriented Software Architecture Volume 1: A System of  Patterns (http://amzn.to/book_POSAV1 ) Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 18
  • 19. Architecture PatternsArchitecture Patterns • More Architecture Patterns:More Architecture Patterns: – Patterns of Enterprise Architecture • http://amzn to/book PEAhttp://amzn.to/book_PEA – Pattern‐Oriented Software Architecture Volume 1:  A System of Patterns • http://amzn.to/book_POSAV1  Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 19
  • 20. Introduction to Design PatternsIntroduction to Design Patterns • What is a Design PatternWhat is a Design Pattern • Architecture Patterns i• Design Patterns Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 20
  • 21. Design patternDesign pattern Framework for thinking and  d i i OO !designing OO programs! Reusable knowledge in SoftwareReusable knowledge in Software  Design! Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 21
  • 22. Design patternDesign pattern Java Frameworks for OOKnowledge Framework Java Frameworks for OO  Development Knowledge Framework  for OO Design Introduction to Design Patterns by João Miguel Pereira is licensed under a Creative  Commons Attribution‐NonCommercial‐ShareAlike 3.0 Unported License 22