SlideShare une entreprise Scribd logo
1  sur  22
DESIGN PATTERNS -- Mudabbir Warsi
AGENDA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction ,[object Object],“ 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 way  that you can use this solution a million times over, with out ever doing it the same way twice” --   Christopher Alexander: The Timeless way of Building ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Myths about Design Patterns ,[object Object],[object Object],[object Object],[object Object],[object Object]
Design Principles ,[object Object],[object Object],“ A module should be open for extension but closed for modification.” ,[object Object],[object Object],“ Sub-classes should be substitutable for their base class .” “ There should never be more than one reason for a class to change .” ,[object Object],“ Talk only to your immediate friends .” “ Depend in the direction of stability .”
Design Principles Contd… ,[object Object],[object Object],“ Solve the most important problem in the simplest possible way.” ,[object Object],[object Object],“ Every piece of knowledge must have a single, unambiguous and authoritative representation with in the system .” “ Many client specific interfaces are better than one general purpose interface .” ,[object Object],“ Classes that aren’t used together, should not be grouped together .” “ Depend upon Abstractions. Never depend upon Concretions .”
Basic Elements of a Design Pattern ,[object Object],[object Object],[object Object],[object Object]
Categories of Design Patterns ,[object Object],Abstract Factory Factory Method Singleton Prototype Builder Structural Adapter Decorator Flyweight Composite Bridge Facade Proxy Behavioral Mediator Iterator Visitor Observer Chain of Responsibility Strategy State Momento Command Interpreter Template Method Let you compose objects and classes into larger structures Involve object Instantiation and all provide a way to decouple a client from the object  it needs to create  Concerned with how objects and classes interact and distribute responsibility
The Pattern Life Cycle Real World  Projects Pattern Mining Author Version Preliminary Document -ation Pattern Polishing Reusable Version Pattern Reuse Incident Occurs of a pattern Discover Patterns Document Document Analyse /  Rule of Three Feedback Modification PHASE 1: MINING Author World PHASE 2: POLISHING Pattern Community World PHASE 3: REUSE Pattern User World
Pattern Hatching 4. A Miracle Occurs 7. Test the Solution 6. Instantiate the Pattern 5. Evaluate Solution 1. Familiarize yourself with Patterns 2. Characterize nature of u r problem 3. Apply Matching
Pattern Refactoring ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Design Patterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Singleton static getInstance( ) // Other useful Methods static uniqueInstance // Other useful data return uniqueInstance ,[object Object],[object Object]
Singleton Contd… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Singleton Contd… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Inside Model-View-Controller 1. The User did something 2. Change your state 3. Change your display 4. I have changed 5. I need your state information VIEW Gives you a presentation of the model. It gets the state and data to be displayed from the model CONTROLLER Takes user input and figures out what it means  to the model MODEL The model holds all the data, state and application logic. It provides an interface to manipulate and retrieve its state.
A Closer Look 1. The User did something 2. Change your state 3. Change your display 4. I have changed 5. I need your state information STRATEGY The view and controller implement the  STRATEGY  pattern: The view is an object that is configured with a strategy. The controller provides the strategy.  Using the strategy pattern keeps the view decoupled from the model. OBSERVER The model implements the  OBSERVER  to keep interested objects updated when the state change occurs.  Using the observer patterns keeps the model decoupled with the view n controller COMPOSITE The view implements the  COMPOSITE  pattern: The display consists of nested set of windows, panels, buttons, text boxes etc.  When the controller tells the view to update, it only has to tell the top view component and the  COMPOSITE  takes care of the rest.
Observer I’d like to register as an observer My State  has changed Observable Observers All these Observers will be notified whenever state changes in the Model Any object that’s interested in the state change of the Model registers with the Model as an Observer.  INTENT: Define a one – many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Strategy The user did something We can swap in another behavior for the View by changing the Controller The Controller is the Strategy for the View – it’s the object that knows how to handle the user action. The View delegates to the Controller to handle the user actions The View only worries about the presentation, the Controller worries about translating user inputs to actions on the Model INTENT: Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithms vary independently from the client that uses it.
Composite Paint ( ) The View is a Composite of GUI components ( buttons, labels, text boxes etc). The top level component contains other components, which contain other components and so on until you get to the leaf nodes. ,[object Object],[object Object],[object Object],INTENT: Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
MVC in Action ,[object Object],Servlet / Controller JSP / View MODEL / DB / Business Logic Bean 1. HTTP Request 5. HTTP Response 2 3 4 ,[object Object],[object Object],[object Object]
EXPERT COMMENTS Today there are more patterns than in the GOF book: Learn them as well. Go for simplicity and don’t become over-excited. If you can come up with a simpler solution without applying a pattern, then go for it. Shoot for practical extensibility. Don’t provide hypothetical generality; be extensible in ways that matter. Patterns are Tools not Rules- They need to be tweaked and adapted to your problem. John Vlissides Richard Helm Ralph Johnson Eric Gamma
Q & A

Contenu connexe

Tendances

Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design patternMindfire Solutions
 
Structural patterns
Structural patternsStructural patterns
Structural patternsHimanshu
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternNishith Shukla
 
GOF Design pattern with java
GOF Design pattern with javaGOF Design pattern with java
GOF Design pattern with javaRajiv Gupta
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaEdureka!
 
Lecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design PatternsLecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design Patternsop205
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design PatternJaswant Singh
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
 
Java Design Pattern Interview Questions
Java Design Pattern Interview QuestionsJava Design Pattern Interview Questions
Java Design Pattern Interview Questionsjbashask
 
Design Pattern
Design PatternDesign Pattern
Design PatternHimanshu
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)paramisoft
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their applicationHiệp Tiến
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns pptmkruthika
 
Design patterns - Proxy & Composite
Design patterns - Proxy & CompositeDesign patterns - Proxy & Composite
Design patterns - Proxy & CompositeSarath C
 

Tendances (19)

Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Structural patterns
Structural patternsStructural patterns
Structural patterns
 
Go f designpatterns 130116024923-phpapp02
Go f designpatterns 130116024923-phpapp02Go f designpatterns 130116024923-phpapp02
Go f designpatterns 130116024923-phpapp02
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design Pattern
 
GOF Design pattern with java
GOF Design pattern with javaGOF Design pattern with java
GOF Design pattern with java
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
Lecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design PatternsLecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design Patterns
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Composite Pattern
Composite PatternComposite Pattern
Composite Pattern
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
Java Design Pattern Interview Questions
Java Design Pattern Interview QuestionsJava Design Pattern Interview Questions
Java Design Pattern Interview Questions
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
 
Design Patterns (Examples in .NET)
Design Patterns (Examples in .NET)Design Patterns (Examples in .NET)
Design Patterns (Examples in .NET)
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their application
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns ppt
 
Design patterns - Proxy & Composite
Design patterns - Proxy & CompositeDesign patterns - Proxy & Composite
Design patterns - Proxy & Composite
 
Design patterns
Design patternsDesign patterns
Design patterns
 

En vedette

01 J2EE patrones
01 J2EE patrones01 J2EE patrones
01 J2EE patronesjuani ruiz
 
Cuebc slides 2
Cuebc slides 2Cuebc slides 2
Cuebc slides 2egregory
 
Line, texture, pattern
Line, texture, patternLine, texture, pattern
Line, texture, patternSimon Gummer
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1Shahzad
 
Texture-Element of Design-Art Lesson
Texture-Element of Design-Art LessonTexture-Element of Design-Art Lesson
Texture-Element of Design-Art LessonDara Cepeda, M. Ed.
 
Element of design texture
Element of design   textureElement of design   texture
Element of design textureMau Palm
 
Principles of Design
Principles of DesignPrinciples of Design
Principles of Designerinsmith.art
 
Окружающий мир_Где живут белые медведи
Окружающий мир_Где живут белые медведиОкружающий мир_Где живут белые медведи
Окружающий мир_Где живут белые медведиМКОУ СОШ № 1 г. Сим
 

En vedette (20)

01 J2EE patrones
01 J2EE patrones01 J2EE patrones
01 J2EE patrones
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Pattern making
Pattern makingPattern making
Pattern making
 
Cuebc slides 2
Cuebc slides 2Cuebc slides 2
Cuebc slides 2
 
Texture
TextureTexture
Texture
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
 
Line, texture, pattern
Line, texture, patternLine, texture, pattern
Line, texture, pattern
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Texture-Element of Design-Art Lesson
Texture-Element of Design-Art LessonTexture-Element of Design-Art Lesson
Texture-Element of Design-Art Lesson
 
Industrial pattern making
Industrial pattern makingIndustrial pattern making
Industrial pattern making
 
Pattern making
Pattern makingPattern making
Pattern making
 
Element of design texture
Element of design   textureElement of design   texture
Element of design texture
 
Patternmaking
PatternmakingPatternmaking
Patternmaking
 
Principles of Design
Principles of DesignPrinciples of Design
Principles of Design
 
Что окружает нас дома
Что окружает нас домаЧто окружает нас дома
Что окружает нас дома
 
агния лювовна барто. верёвочка
агния лювовна барто. верёвочкаагния лювовна барто. верёвочка
агния лювовна барто. верёвочка
 
Великая забытая война
Великая забытая войнаВеликая забытая война
Великая забытая война
 
Окружающий мир_Где живут белые медведи
Окружающий мир_Где живут белые медведиОкружающий мир_Где живут белые медведи
Окружающий мир_Где живут белые медведи
 
Шлях ад пачатку стагоддзя: да 115-годдзя з дня нараджэння Міхаіла Ганчарыка
Шлях ад пачатку стагоддзя: да 115-годдзя з дня нараджэння Міхаіла ГанчарыкаШлях ад пачатку стагоддзя: да 115-годдзя з дня нараджэння Міхаіла Ганчарыка
Шлях ад пачатку стагоддзя: да 115-годдзя з дня нараджэння Міхаіла Ганчарыка
 
Marketing personal 01
Marketing personal 01Marketing personal 01
Marketing personal 01
 

Similaire à Design patterns

Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in androidJay Kumarr
 
Design Principles to design Patterns
Design Principles to design PatternsDesign Principles to design Patterns
Design Principles to design PatternsFaizan Haider
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patternssukumarraju6
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and DesignDr. C.V. Suresh Babu
 
Design Pattern with Actionscript
Design Pattern with ActionscriptDesign Pattern with Actionscript
Design Pattern with ActionscriptDaniel Swid
 
Solid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven DesignSolid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven DesignIrwansyah Irwansyah
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.pptAnkitPangasa1
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.pptbryafaissal
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns Yoss Cohen
 
Modular Web Design With Components
Modular Web Design With ComponentsModular Web Design With Components
Modular Web Design With ComponentsNadal Soler
 
SOLID Principles and The Clean Architecture
SOLID Principles and The Clean ArchitectureSOLID Principles and The Clean Architecture
SOLID Principles and The Clean ArchitectureMohamed Galal
 
Design and Implementation in Software Engineering
Design and Implementation in Software EngineeringDesign and Implementation in Software Engineering
Design and Implementation in Software EngineeringKourosh Sajjadi
 
P Training Presentation
P Training PresentationP Training Presentation
P Training PresentationGaurav Tyagi
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsLalit Kale
 

Similaire à Design patterns (20)

Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
 
Design Principles to design Patterns
Design Principles to design PatternsDesign Principles to design Patterns
Design Principles to design Patterns
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Design Pattern with Actionscript
Design Pattern with ActionscriptDesign Pattern with Actionscript
Design Pattern with Actionscript
 
Solid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven DesignSolid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven Design
 
Testing method pptx
Testing method pptxTesting method pptx
Testing method pptx
 
Design patterns
Design patternsDesign patterns
Design patterns
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.ppt
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.ppt
 
ActionScript Design Patterns
ActionScript Design Patterns ActionScript Design Patterns
ActionScript Design Patterns
 
Modular Web Design With Components
Modular Web Design With ComponentsModular Web Design With Components
Modular Web Design With Components
 
L03 Design Patterns
L03 Design PatternsL03 Design Patterns
L03 Design Patterns
 
SOLID Principles and The Clean Architecture
SOLID Principles and The Clean ArchitectureSOLID Principles and The Clean Architecture
SOLID Principles and The Clean Architecture
 
Design and Implementation in Software Engineering
Design and Implementation in Software EngineeringDesign and Implementation in Software Engineering
Design and Implementation in Software Engineering
 
Design pattern
Design patternDesign pattern
Design pattern
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
 

Dernier

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
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
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Dernier (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
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
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

Design patterns

  • 1. DESIGN PATTERNS -- Mudabbir Warsi
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. The Pattern Life Cycle Real World Projects Pattern Mining Author Version Preliminary Document -ation Pattern Polishing Reusable Version Pattern Reuse Incident Occurs of a pattern Discover Patterns Document Document Analyse / Rule of Three Feedback Modification PHASE 1: MINING Author World PHASE 2: POLISHING Pattern Community World PHASE 3: REUSE Pattern User World
  • 10. Pattern Hatching 4. A Miracle Occurs 7. Test the Solution 6. Instantiate the Pattern 5. Evaluate Solution 1. Familiarize yourself with Patterns 2. Characterize nature of u r problem 3. Apply Matching
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Inside Model-View-Controller 1. The User did something 2. Change your state 3. Change your display 4. I have changed 5. I need your state information VIEW Gives you a presentation of the model. It gets the state and data to be displayed from the model CONTROLLER Takes user input and figures out what it means to the model MODEL The model holds all the data, state and application logic. It provides an interface to manipulate and retrieve its state.
  • 16. A Closer Look 1. The User did something 2. Change your state 3. Change your display 4. I have changed 5. I need your state information STRATEGY The view and controller implement the STRATEGY pattern: The view is an object that is configured with a strategy. The controller provides the strategy. Using the strategy pattern keeps the view decoupled from the model. OBSERVER The model implements the OBSERVER to keep interested objects updated when the state change occurs. Using the observer patterns keeps the model decoupled with the view n controller COMPOSITE The view implements the COMPOSITE pattern: The display consists of nested set of windows, panels, buttons, text boxes etc. When the controller tells the view to update, it only has to tell the top view component and the COMPOSITE takes care of the rest.
  • 17. Observer I’d like to register as an observer My State has changed Observable Observers All these Observers will be notified whenever state changes in the Model Any object that’s interested in the state change of the Model registers with the Model as an Observer. INTENT: Define a one – many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
  • 18. Strategy The user did something We can swap in another behavior for the View by changing the Controller The Controller is the Strategy for the View – it’s the object that knows how to handle the user action. The View delegates to the Controller to handle the user actions The View only worries about the presentation, the Controller worries about translating user inputs to actions on the Model INTENT: Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithms vary independently from the client that uses it.
  • 19.
  • 20.
  • 21. EXPERT COMMENTS Today there are more patterns than in the GOF book: Learn them as well. Go for simplicity and don’t become over-excited. If you can come up with a simpler solution without applying a pattern, then go for it. Shoot for practical extensibility. Don’t provide hypothetical generality; be extensible in ways that matter. Patterns are Tools not Rules- They need to be tweaked and adapted to your problem. John Vlissides Richard Helm Ralph Johnson Eric Gamma
  • 22. Q & A