Factory Method Pattern. Admin SCPI Patner Day Feb. 21 Lunch count Presentation (4-8 min.) Practice on Feb. 16. Morning availablity on Feb21 Brief overview.

Slides:



Advertisements
Similar presentations
Creational Design Patterns. Creational DP: Abstracts the instantiation process Helps make a system independent of how objects are created, composed, represented.
Advertisements

 Recent researches show that predicative programming can be used to specify OO concepts including classes, objects, interfaces, methods, single and multiple.
Factory Pattern Building Complex Objects. New is an implementation  Calling “new” is certainly coding to an implementation  In fact, it’s always related.
Chapter 4: The Factory Pattern. Consider the Following Code Fragment Duck duck; if (picnic) { duck = new MallardDuck(); } else if (hunting) { duck = new.
CS 210 Introduction to Design Patterns September 19 th, 2006.
More Interfaces, Dynamic Binding, and Polymorphism Kirk Scott.
 Consists of Creational patterns  Each generator pattern has a Client, Product, and Generator.  The Generator needs at least one operation that creates.
Informatics 122 Software Design II Lecture 5 Emily Navarro Duplication of course material for any commercial purpose without the explicit written permission.
Prototype Pattern Creational Pattern Specify the kinds of objects to create using a prototypical instance, and create new objects by copy this prototype.
DESIGN PATTERNS Redesigning Applications And
March Ron McFadyen1 Singleton pattern Singleton is designed to restrict instantiation of a class to one (or a few) objects. Useful when exactly.
Creational Patterns: The Abstract Factory CSE 335 Spring 2008 E. Kraemer.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
+ Informatics 122 Software Design II Lecture 8 Emily Navarro Duplication of course material for any commercial purpose without the explicit written permission.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Design Patterns.
CS 210 Introduction to Design Patterns September 28 th, 2006.
Case Studies on Design Patterns Design Refinements Examples.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Abstract Factory Design Pattern making abstract things.
Factory Method A Creational Design Pattern. Factory Method Key Features  Defines an interface for creating objects without needing to know each object’s.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
Tech Talk Go4 Factory Patterns Presented By: Matt Wilson.
Abstract Factory Abstract Factory using Factory Method.
12/6/20041 The Factory Method Pattern Presenters 王世賀 F 陳祐毓 F 張峻銘 F 吳佩達 F 林俊成 F 鄭榮智 F 許書豪 F
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
The Factory Patterns SE-2811 Dr. Mark L. Hornick 1.
Design Patterns Façade, Singleton, and Factory Methods Team Good Vibrations (1)
Mohammed Al-Dhelaan CSci 253 Object Oriented Design Instructor: Brad Taylor 06/02/2009 Factory Method Pattern.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
Factory Method Chris Colasuonno Also known as “Virtual Constructor”
Define an interface for creating an object, but let subclasses decide which class to instantiate Factory Method Pattern.
The Factory Method Design Pattern Motivation: Class / Type separation – Abstract class serves as type definition and concrete class provides implementation.
CS 4233 Review Feb February Review2 Outline  Previous Business – My.wpi.edu contains all grades to date for course – Review and contact.
Factory Method Explained. Intent  Define an interface for creating an object, but let subclasses decide which class to instantiate.  Factory Method.
Define an interface for creating an object, but let subclasses decide which class to instantiate.
CSC 480 Software Engineering Design With Patterns.
Builder An Object Creational Pattern Tim Rice CSPP51023 March 2, 2010.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
The Factory Pattern Sanjay Yadav (ISE ).
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
Singleton Pattern Presented By:- Navaneet Kumar ise
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
The State Design Pattern A behavioral design pattern. Shivraj Persaud
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
SE 461 Software Patterns. ABSTRACT FACTORY PATTERN.
SE 461 Software Patterns. FACTORY METHOD PATTERN.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Factory Method. Intent/Purpose Factory Method is used to deal with a problem of creating objects without specifying the EXACT class of object that we.
Design Patterns: MORE Examples
Unit II-Chapter No. : 5- design Patterns
Factory Method Pattern
Design Patterns Spring 2017.
Chapter 10 Design Patterns.
Software Design Patterns
Factory Patterns 1.
Software Design and Architecture
Software Design and Architecture
More Interfaces, Dynamic Binding, and Polymorphism
Factory Method Pattern
Abstract Factory Pattern
State Design Pattern 1.
Object Oriented Design Patterns - Creational Patterns
PH Chapter 3 Thanks for the Memory Leaks Pushme-Pullyu (pp
BRIDGE PATTERN.
Creational Patterns.
Design by Abstraction (Continuation) CS 3331 Spring 2005
Presentation transcript:

Factory Method Pattern

Admin SCPI Patner Day Feb. 21 Lunch count Presentation (4-8 min.) Practice on Feb. 16. Morning availablity on Feb21 Brief overview of the problem Describe your approach to the problem UI mockups, prototype demo, key elements of design, architecture diagrams, design issues Focus on things that are interesting Progress to date

Factory Method Pattern Intent Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. Also known as “Virtual Constructor” Motivating example A drawing application with DrawingApplication and DrawingDocument abstract classes. DrawingApplication needs to know which subclass of DrawingDocument to create.

Dealing with Class Instantiation Whenever we new a class, we are creating an instance of a concrete class. – Program to interface instead of implementation? – Build for change? – Open for extension, close to modification?

Pizza Store Example

Encapsulate Object Creation Pull out object creation part (because it varies), encapsulate it in an object, call it a factory.

Use the Factory

Now Franchising the Store

What's wrong with this? Don't know if the same procedure Is followed in all stores.

Move Pizza Making Back to PizzaStore

Subclass decides

Factory Method Pattern