March 200391.3913 R McFadyen1 GoF (Gang of Four): Gamma, Johnson, Helm & Vlissides Book: Design Patterns: Elements of Reusable Object-Oriented Software.

Slides:



Advertisements
Similar presentations
Design Patterns based on book of Gang of Four (GoF) Erich Gamma, Richard Helm, Ralph Johnson, and John VlissidesGang of Four (GoF) Elements of Reusable.
Advertisements

Visibility Larman, Chapter 19 (with ideas from George Blank of NJIT) CSE432 Object Oriented Software Engineering.
March Ron McFadyen1 Design Patterns In software engineering, a design pattern is a generally repeatable solution to a commonly-occurring problem.
Jan Ron McFadyen1 Singleton To guarantee that there is at most one instance of a class we can apply the singleton pattern. Singleton Static.
March R McFadyen1 Architecture Architecture involves the set of significant decisions about the organization of a software system, decisions.
Oct Ron McFadyen1 Singleton To guarantee that there is at most one instance of a class we can apply the singleton pattern. Singleton Static.
Nov R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (section 23.3 has a Simple.
Design Patterns Yes, they are important Robert Cotton April 23, 2009.
Fall 2009ACS-3913 R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (Simple Factory) Prototype.
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
March R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (in Larman) Prototype Singleton.
Design Patterns CS is not simply about programming
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
March Ron McFadyen1 Design Patterns In software engineering, a design pattern is a generally repeatable solution to a commonly-occurring problem.
Fall 2009ACS-3913 R McFadyen1 GoF Patterns, chapter 26 GoF book presents 23 patterns: Creational – 5 Structural – 7 Behavioural – 11 Larman discusses 7.
March R McFadyen1 Façade. March R McFadyen2 Facade P Main Entry: fa·cade Variant(s): also fa·çade / f&-'säd/ Function: noun.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Fall 2009ACS-3913 R McFadyen1 Singleton Problem: Exactly one instance of a certain object is required (this object is called a singleton). We must ensure.
Fall 2009ACS-3913 Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Date: 1753 an interpretation.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
Builder A Creational Design Pattern A Presentation by Alex Bluhm And.
Design Dan Fleck CS 421 George Mason University. What is the design phase? Analysis phase describes what the system should do Analysis has provided a.
樣式導向設計 (Pattern-Oriented Design) 課程簡介 Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
CSSE 374: Introduction to Gang of Four Design Patterns
1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris
Factory, Singleton & Strategy All References and Material From: Applying UML and Patterns, 3 rd ed, chpt 26 & 13 BTS530: Major Project Planning and Design.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Aniruddha Chakrabarti
BTS430 Systems Analysis and Design using UML Design Patterns.
January 12, Introduction to Design Patterns Tim Burke References: –Gamma, Erich, et. al. (AKA, The Gang of Four). Design Patterns: Elements of Reusable.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
Singleton and Basic UML CS340100, NTHU Yoshi. What is UML Unified Modeling Language A standardized general-purpose modeling language in the field of software.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
Creational Patterns
Programmeerimine Delphi keskkonnas MTAT Programmeerimine Delphi keskkonnas MTAT Jelena Zaitseva
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
Gang of Four Patterns 23 total 15 useful How are they different from GRASP Patterns?
Design Patterns Introduction
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
Singleton Pattern Presented By:- Navaneet Kumar ise
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
1 Lecture Material Design Patterns Visitor Client-Server Factory Singleton.
The Object-Oriented Thought Process Chapter 15
Presentation on GoF Design Patterns Submitted by WWW. ASSIGNMENTPOINT
樣式導向設計 (Pattern-Oriented Design) 課程簡介
GoF Patterns (GoF) popo.
MPCS – Advanced java Programming
Design Patterns Introduction
Design Patterns (GoF) contains the creational patterns:
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
GoF Design Patterns (Ch. 26)
08/15/09 Design Patterns James Brucker.
Object Oriented Design Patterns - Creational Patterns
Chapter 22 Object-Oriented Design
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
GoF Design Patterns (Ch. 26)
CS 350 – Software Design Singleton – Chapter 21
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
GoF Patterns Ch. 26.
Presentation transcript:

March R McFadyen1 GoF (Gang of Four): Gamma, Johnson, Helm & Vlissides Book: Design Patterns: Elements of Reusable Object-Oriented Software 1995 GoF Patterns – Ch 23

March R McFadyen2 Design Patterns contains the GoF patterns including: Abstract factory (23.3) Builder Factory method Prototype Singleton (23.4) These are creational patterns for the instantiation process Help to make a system independent of how its objects are created They hide how instances of classes are created GoF Patterns

March R McFadyen3 Factory (23.3) Problem: who should be responsible for creating objects when there are special considerations such as complex creational logic, … Solution: create a Pure Fabrication object called a Factory that handles the creation Factory Pattern

March R McFadyen4 Textbook example The NextGen POS system supports several kinds of 3 rd party services. For example: tax calculators such as TaxMaster and Good As Gold, account packages such as SAP and Great Northern. The support is provided through “adapters”. The text is concerned with determining the class that should create the required adapters. Choosing a class in the domain model will lower the cohesion of that class. Applying the Factory Pattern, we would then have a Factory object that is given the responsibility to create such adapter objects. Factory Pattern

March R McFadyen5 Singleton (23.4) Problem: Exactly one instance of a certain object is required (this object is called a singleton). Ensure a class has only one instance. (Factories and Facades are usually singletons). Solution: use a static method of the class to return the singleton Singleton Pattern

March R McFadyen6 Singleton (23.4) In Java, you would have code such as: Public static synchronized ServicesFactory getInstance() { If (instance == null) Instance := new ServicesFactory() Return instance } Singleton Pattern The point of the above is that only one instance is ever created. If one already exists, then the create is bypassed and the reference to the existing object is returned.

March R McFadyen7 Singleton Pattern Collaboration diagram: suppose an instance of the ServicesFactory is created and, later on, a message, doIt, is passed to this instance. (Note: on page 350 the text makes reference to the situation illustrated below as “uninteresting”) :Register :ServicesFactory getInstance() ServicesFactory create() doIt()

March R McFadyen8 Singleton Pattern Figure 23.6 :Register :AccountingAdapter getAccountingAdapter() > :ServicesFactory create() doIt() By applying the > stereotype to this object, they are implying that the getInstance method was used to instantiate it.

March R McFadyen9 Singleton Pattern The text makes reference to Lazy Instantiation – The ServicesFactory object was created when it was needed, and not before :Register :AccountingAdapter getAccountingAdapter() > :ServicesFactory create() doIt()

March R McFadyen10 Singleton Pattern Example of Design Patterns Explained (Shalloway & Trott)