SlideShare une entreprise Scribd logo
1  sur  56
Design  Patterns  Dr. K. Priyantha Hewagamage Advanced Software Engineering
What is Design Pattern? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Pattern origins and history ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Definitions ,[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Definitions ….. ,[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Properties ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Properties (2) ,[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Ingredients  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Pattern description (Pattern template) ,[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],University of Colombo School of Computing Advanced Software Engineering
Types of software patterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Pattern language ,[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Pattern catalogs and systems ,[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Types of Design Patterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Pattern Scope ,[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Design pattern catalog  University of Colombo School of Computing Advanced Software Engineering
The Singleton Pattern ,[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
The Singleton Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Singleton ,[object Object],University of Colombo School of Computing Advanced Software Engineering public class Singleton {  static Singleton theInstance  = new Singleton();  private Singleton() { }  public static Singleton getInstance()  {  return theInstance;  }  } « Singleton » theInstance getInstance
Exercise ,[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
The Abstraction-Occurrence Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Abstraction-Occurrence  ,[object Object],University of Colombo School of Computing Advanced Software Engineering TVSeries seriesName producer Episode number title storySynopsis * * * * * * «Occurrence» «Abstraction» * * * * * * Title name author LibraryItem barCodeNumber * * * * * * isbn publicationDate libOfCongress
Abstraction-Occurrence  ,[object Object],University of Colombo School of Computing Advanced Software Engineering name author LibraryItem barCodeNumber isbn publicationDate libOfCongress Title name author LibraryItem barCodeNumber isbn publicationDate libOfCongress name author LibraryItem barCodeNumber isbn publicationDate libOfCongress GulliversTravels MobyDick
Abstraction-Occurrence ,[object Object],University of Colombo School of Computing Advanced Software Engineering ScheduledTrain number SpecificTrain date * * * * ScheduledLeg SpecificLeg actualDepTime * actualArrTime scheduledDepTime scheduledArrTime Station origin destination * *
The General Hierarchy  Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
General Hierarchy ,[object Object],University of Colombo School of Computing Advanced Software Engineering «subordinate» * «Node» «SuperiorNode» «NonSuperiorNode» 0..1 * supervises Manager Employee Technician Secretary 0..1 * contains Directory FileSystemItem File 0..1
General Hierarchy ,[object Object],University of Colombo School of Computing Advanced Software Engineering RockRecording BluesRecording ClassicalRecording JazzRecording MusicVideo VideoRecoding AudioRecording Recording
The Player-Role Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Player-Role ,[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering «Player» «Role1» «Role2» «AbstractRole»
Player-Role ,[object Object],University of Colombo School of Computing Advanced Software Engineering
Player-Role ,[object Object],University of Colombo School of Computing Advanced Software Engineering
Player-Role ,[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
The Observer Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Observer ,[object Object],University of Colombo School of Computing Advanced Software Engineering WeatherViewer * * * * * * * Observers are  notified when a new  prediction is ready Forecaster Observable «ConcreteObservable» «ConcreteObserver» «Observable» addObserver notifyObservers «interface» «Observer» update * * * * * * * «interface» Observer
University of Colombo School of Computing Advanced Software Engineering
University of Colombo School of Computing Advanced Software Engineering
Observer ,[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
The Delegation Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Delegation ,[object Object],University of Colombo School of Computing Advanced Software Engineering delegate.method();  « Delegate » « Delegator » delegatingMethod()  {  }  delegatingMethod method LinkedList addFirst addLast addAfter removeFirst removeLast delete isEmpty Stack push pop isEmpty push() {  list.addFirst(); }
Delegation University of Colombo School of Computing Advanced Software Engineering Example: two levels of delegation
Delegation ,[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering return specificFlight.regularFlight.flightNumber(); return getRegularFlight().flightNumber();
The Adapter Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Adapter ,[object Object],University of Colombo School of Computing Advanced Software Engineering «Adaptee» adaptedMethod «Superclass» polymorphicMethod «Adapter» polymorphicMethod() return  adaptee.adaptedMethod(); {  }
Adapter ,[object Object],University of Colombo School of Computing Advanced Software Engineering TimsTorus calcVolume ThreeDShape volume Sphere Torus volume() return  TimsTorus.calcVolume(); {  }
Adapters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
The Façade Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Façade ,[object Object],University of Colombo School of Computing Advanced Software Engineering «PackageClass3» «PackageClass2» «PackageClass1» * * * * * * RegularFlight * * * * * * Reservation Airline findFlight makeBooking deleteBooking «Facade»
The Immutable Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
The Read-only Interface Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Read-only Interface ,[object Object],University of Colombo School of Computing Advanced Software Engineering «UnprivilegedClass» * * * * * * «Mutator» «Mutable» attribute «private» getAttribute setAttribute «interface» «ReadOnlyInterface» getAttribute * * * * *
Read-only Interface ,[object Object],University of Colombo School of Computing Advanced Software Engineering Mutableperson firstName lastName setFirstName setLastName getName «interface» Person getName
The Proxy Pattern ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Proxy ,[object Object],University of Colombo School of Computing Advanced Software Engineering «interface» «ClassIF» * * * * * * * «Client» «HeavyWeight» «Proxy»
Proxy ,[object Object],University of Colombo School of Computing Advanced Software Engineering «interface» ListIF The list elements will  be loaded into local  memory only when  needed. ListProxy PersistentList «interface» Student PersistentStudent StudentProxy
Difficulties and Risks When Creating Class Diagrams  ,[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering
Difficulties and Risks When Creating Class Diagrams ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],University of Colombo School of Computing Advanced Software Engineering

Contenu connexe

Tendances

Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patternsAmit Kabra
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software EngineeringManish Kumar
 
Creational pattern
Creational patternCreational pattern
Creational patternHimanshu
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design PatternsAnton Keks
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General IntroductionAsma CHERIF
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns pptmkruthika
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaEdureka!
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagramRahul Pola
 
Architecture design in software engineering
Architecture design in software engineeringArchitecture design in software engineering
Architecture design in software engineeringPreeti Mishra
 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patternsLilia Sfaxi
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and DesignHaitham El-Ghareeb
 
Coupling and cohesion
Coupling and cohesionCoupling and cohesion
Coupling and cohesionSutha31
 
Design patterns creational patterns
Design patterns creational patternsDesign patterns creational patterns
Design patterns creational patternsMalik Sajid
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML DiagramsManish Kumar
 

Tendances (20)

Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software Engineering
 
Creational pattern
Creational patternCreational pattern
Creational pattern
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns ppt
 
Unified process Model
Unified process ModelUnified process Model
Unified process Model
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
 
Software design
Software designSoftware design
Software design
 
Architecture design in software engineering
Architecture design in software engineeringArchitecture design in software engineering
Architecture design in software engineering
 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Coupling and cohesion
Coupling and cohesionCoupling and cohesion
Coupling and cohesion
 
Design patterns creational patterns
Design patterns creational patternsDesign patterns creational patterns
Design patterns creational patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
SDLC, Iterative Model
SDLC, Iterative ModelSDLC, Iterative Model
SDLC, Iterative Model
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
 

Similaire à Design Patterns

Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)stanbridge
 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categoriesHimanshu
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2Ankit Dubey
 
Prophecy Of Design Patterns
Prophecy Of Design PatternsProphecy Of Design Patterns
Prophecy Of Design Patternspradeepkothiyal
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...Anil Sharma
 
Oops design pattern intro
Oops design pattern intro Oops design pattern intro
Oops design pattern intro anshu_atri
 
5 Design Patterns Explained
5 Design Patterns Explained5 Design Patterns Explained
5 Design Patterns ExplainedPrabhjit Singh
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfB.T.L.I.T
 
Software Patterns
Software PatternsSoftware Patterns
Software Patternskim.mens
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patternssukumarraju6
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1Shahzad
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptxSHAHZAIBABBAS13
 
Patterns for the People
Patterns for the PeoplePatterns for the People
Patterns for the PeopleKevlin Henney
 

Similaire à Design Patterns (20)

Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)
 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categories
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Prophecy Of Design Patterns
Prophecy Of Design PatternsProphecy Of Design Patterns
Prophecy Of Design Patterns
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Oops design pattern intro
Oops design pattern intro Oops design pattern intro
Oops design pattern intro
 
5 Design Patterns Explained
5 Design Patterns Explained5 Design Patterns Explained
5 Design Patterns Explained
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
 
.Net design pattern
.Net design pattern.Net design pattern
.Net design pattern
 
Software Patterns
Software PatternsSoftware Patterns
Software Patterns
 
Patterns Overview
Patterns OverviewPatterns Overview
Patterns Overview
 
What is design pattern
What is design patternWhat is design pattern
What is design pattern
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptx
 
Patterns for the People
Patterns for the PeoplePatterns for the People
Patterns for the People
 

Dernier

General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
Patterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptxPatterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptxMYDA ANGELICA SUAN
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17Celine George
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 

Dernier (20)

General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdfPersonal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
 
Patterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptxPatterns of Written Texts Across Disciplines.pptx
Patterns of Written Texts Across Disciplines.pptx
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
Finals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quizFinals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quiz
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 

Design Patterns

  • 1. Design Patterns Dr. K. Priyantha Hewagamage Advanced Software Engineering
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. Design pattern catalog University of Colombo School of Computing Advanced Software Engineering
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. University of Colombo School of Computing Advanced Software Engineering
  • 36. University of Colombo School of Computing Advanced Software Engineering
  • 37.
  • 38.
  • 39.
  • 40. Delegation University of Colombo School of Computing Advanced Software Engineering Example: two levels of delegation
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.

Notes de l'éditeur

  1. As mentioned before, the current use of the term "pattern" is derived from the writings of the architect Christopher Alexander who has written several books on the topic as it relates to urban planning and building architecture (list of books). Patterns in software first became popular with the wide acceptance of the book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (frequently referred to as the Gang of Four or just GoF). Other recent books that have helped popularize patterns are: Pattern-Oriented Software Architecture: A System of Patterns ( also called the POSA book ) by Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal (sometimes called the Siemens Gang of Five or just GoV); and the books Pattern Languages of Program Design and Pattern Languages of Program Design 2, which are selected papers from the first and second conferences on Patterns Languages of Program Design (PLoP or PLoPD). Many of these books are part of the Software Patterns Series from Addison-Wesley.
  2. It is unavoidable to mention what Alexander says about patterns, since the origin of design patterns lies in work done by him in late 70is. Although Alexander was talking about patterns in buildings, the core of patterns in object-oriented design and building is a solution to a problem in a context. In "Understanding and Using Patterns in Software Development", Dirk Riehle and Heinz Zullighoven give a nice definition of the term "pattern" which is very broadly applicable. Coplein in his paper “Software Design Patterns: Common questions and Answers” refers to patterns as both the thing and the instructions for making the thing. Basically, pattern can be viewed as a particular prose form of recording design information such that designs which have worked well in the past can be applied again in similar situations in the future. (Beck, Coplien - “Industrial experience with design patterns”
  3. Patterns provide a common vocabulary for designers to communicate, document, and explore design alternatives (Gamma93-paper). Consequently enabling effective communicating of complex concepts between designers. Patterns capture solutions and essential parts of design in a compact form. Pattern describe software abstractions, ensuring vide applicability, but a pattern may provide hints about potential implementation issues). Simply said, patterns help designer get a design “right” faster. Patterns are not necessarily object.oriented, and patterns can be found in a variety of software systems, independent of the methods used in developing those systems (Coplien, Industrial experience) However, a pattern is not an implementation. It describes when, why, and how to go about creating an implementation or other engineering product. Also, patterns do not solve all design problems.
  4. Patterns provide a common vocabulary for designers to communicate, document, and explore design alternatives (Gamma93-paper). Consequently enabling effective communicating of complex concepts between designers. Patterns capture solutions and essential parts of design in a compact form. Pattern describe software abstractions, ensuring vide applicability, but a pattern may provide hints about potential implementation issues). Simply said, patterns help designer get a design “right” faster. Patterns are not necessarily object.oriented, and patterns can be found in a variety of software systems, independent of the methods used in developing those systems (Coplien, Industrial experience) However, a pattern is not an implementation. It describes when, why, and how to go about creating an implementation or other engineering product. Also, patterns do not solve all design problems.
  5. Every pattern has these essential elements: Context - refers to a recurring set of situations in which the pattern applies. Problem -refers to a set of forces -- goals and constraints -- that occur in this context. (describes when to apply the pattern) Solution -refers to a design form or design rule that someone can apply to resolve these forces. (describes the elements that make up design, their relationships, responsibilities and collaboration)
  6. Much of the initial patterns focus in the software community has been on design patterns. The patterns in the [GoF] book are object-oriented design patterns. However, there are many other kinds of software patterns besides design patterns. For example, Martin Fowler has written a book of Analysis Patterns. Patterns cover all aspects of software engineering including: development organization, software process, project planning, requirements engineering, and software configuration, management (just to name a few). Presently however, design patterns still seem to be the most popular (though organization patterns seem to be gaining momentum). ---- The difference between these three kinds of design patterns are in their corresponding levels of abstraction and detail. Architectural patterns are high-level strategies that concern large-scale components and the global properties and mechanisms of a system. They have wide-sweeping implications which affect the overall skeletal structure and organization of a software system. Design patterns are medium-scale tactics that flesh out some of the structure and behavior of entities and their relationships. They do not influence overall system structure, but instead define micro-architectures of subsystems and components. Idioms are paradigm-specific and language-specific programming techniques that fill in low-level internal or external details of a component's structure or behavior.
  7. In the Patterns Definitions section of the Patterns Home Page, Cope defines a pattern language as follows: A pattern language defines a collection of patterns and the rules to combine them into an architectural style. Pattern languages describe software frameworks or families of related systems. Cope gives a slightly different definition in "Software Design Patterns: Common Questions and Answers": A pattern language is a structured collection of patterns that build on each other to transform needs and constraints into an architecture. A pattern language includes rules and guidelines which explain how and when to apply its patterns to solve a problem which is larger than any individual pattern can solve. These rules and guidelines suggest the order and granularity for applying each pattern in the language. A pattern language may be regarded as a lexicon of patterns plus a grammar that defines how to weave them together into valid sentences (or artful tapestries if you will). Ideally, good pattern languages are generative, capable of generating all the possible sentences from a rich and expressive pattern vocabulary.
  8. The authors of [POSA] have classified different kinds of pattern collections that possess varying degrees of structure and interaction into pattern catalogs, systems, and languages: Pattern Catalogs A pattern catalog is a collection of related patterns (perhaps only loosely or informally related). It typically subdivides the patterns into at least a small number of broad categories and may include some amount of cross referencing between patterns. Pattern Systems A pattern system is a cohesive set of related patterns which work together to support the construction and evolution of whole architectures. It describes many interrelationships between the patterns and their groupings and how they may be combined and composed to solve more complex problems. The primary difference between the pattern system and a pattern language is that, ideally, pattern languages are computationally complete, showing all possible combinations of patterns and their variations to produce complete architectures. In practice however, the difference between pattern systems and pattern languages can be extremely difficult to ascertain.
  9. Structural patterns form larger structures from individual parts, generally of different classes. Structural patterns vary a great deal depending on what sort of structure is being created for what purpose. to describe interactions between objects. They focus on how objects communicate with each other. They can reduce complex flow charts to mere interconnections between objects of various classes.
  10. In Gamma’s book, patterns are classified by two criteria. First is Purpose, which reflects what pattern does. Patterns can have either creational, structural, or behavioral purpose. Creational patterns concern the process of object creation. Structural patterns deal with the composition of classes or objects. Behavioral patterns characterize the ways in which classes or objects interact and distribute responsibility. The second criterion is scope, which specifies whether the pattern applies primarly on classes or objects. Class patterns deal with relationships between classes and their sub-classes. These relationships are established through inheritance, so they are static (fixed at compile time). Object patterns deal with object relationships, which can be changed at run-time and are more dynamic. (petterns labeled as class patterns are those that focus on class relationships.
  11. Example: 1. All episodes of
  12. Real mistakes made by beginners
  13. If u compile one class, then other one also have to be modified if it is a bi-directional association relationship.
  14. Structural Pattern
  15. Another gan of four pattern, also known as wrappers Structural Pattern