© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.1 Roadmap  Generics  Abstract Factory  Annotations  Model-Driven Engineering.

Slides:



Advertisements
Similar presentations
Parametric Aspects. A way to design-pattern implementation (...and others)? Jordi Alvarez Open University of Catalonia Barcelona - Spain
Advertisements

Creational Design Patterns. Creational DP: Abstracts the instantiation process Helps make a system independent of how objects are created, composed, represented.
Creational Patterns, Abstract Factory, Builder Billy Bennett June 11, 2009.
Design Patterns CMPS Design Patterns Consider previous solutions to problems similar to any new problem ▫ must have some characteristics in common.
CSE3308/CSC Software Engineering: Analysis and DesignLecture 5B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/CSC3080/DMS/2000/12.
COP 3331 Object Oriented Analysis and Design Chapter 7 – Design by Abastraction Jean Muhammad.
Design Patterns A General reusable solution to a commonly occurring problem in software design. Creational: Deal with object creation mechanisms – Example:
Plab – Tirgul 12 Design Patterns
 Consists of Creational patterns  Each generator pattern has a Client, Product, and Generator.  The Generator needs at least one operation that creates.
. Plab – Tirgul 12 Design Patterns. Design Patterns u The De-Facto Book on Design Patterns:
CS 4233 : Object-Oriented Analysis and Design Concrete Factory Abstract Factory.
8. Java: Generics and Annotations. © O. Nierstrasz P2 — Clients and Servers 8.2 Generics and Annotations Overview  Generics  The Abstract Factory Pattern.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Abstract Factory Pattern.
Pattern Abstract Factory
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Design Patterns.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns II.
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.
Copyright © 2002, Systems and Computer Engineering, Carleton University Patterns.ppt * Object-Oriented Software Development Part 11.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Software Components Creational Patterns.
Beware of bugs in the above code; I have only proved it correct, not tried it.
Abstract Factory Abstract Factory using Factory Method.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
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.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 Reusing threads.
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.
Abstract Factory and Factory Method CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
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 313 – Advanced Programming Topics. What Is the Factory Method?  Creation details hidden by AbstractCreator  Does effective job of limiting concrete.
Creational Pattern: Factory Method At times, a framework is needed to standardize the behavior of objects that are used in a range of applications, while.
CSC 480 Software Engineering Design With Patterns.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
Design Patterns Introduction
Religious Studies 313 – Advanced Programming Topics.
What is Iterator Category: Behavioral Generic Way to Traverse Collection Not Related to Collection Implementation Details Not Related to the direction/fashion.
Advanced Object-oriented Design Patterns Creational Design Patterns.
CSC 480 Software Engineering Design With Patterns.
Reference – Object Oriented Software Development Using Java - Jia COP 3331 Object Oriented Analysis and Design Chapter 10 – Patterns Jean Muhammad.
 Creational design patterns abstract the instantiation process.  make a system independent of how its objects are created, composed, and represented.
Singleton Pattern. Problem Want to ensure a single instance of a class, shared by all uses throughout a program Context Need to address initialization.
The Abstract Factory Pattern (Creational) ©SoftMoore ConsultingSlide 1.
POLYMORPHISM Chapter 6. Chapter Polymorphism  Polymorphism concept  Abstract classes and methods  Method overriding  Concrete sub classes and.
Class Relationships Lecture Oo08 Polymorphism. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 10 p.125 n Fowler & Scott, UML.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Abstract Factory Pattern Jiaxin Wang CSPP Winter 2010.
Abstract Factory pattern Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Design Patterns: MORE Examples
Abstract Factory Pattern
Design Patterns: Brief Examples
Design Patterns C++ Java C#.
Factory Patterns 1.
Design Patterns C++ Java C#.
Software Design and Architecture
JAVA Design Patterns.
Abstract Factory Pattern
Intent (Thanks to Jim Fawcett for the slides)
ABSTRACT FACTORY.
Software Engineering Lecture 7 - Design Patterns
CSC 480 Software Engineering
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
class PrintOnetoTen { public static void main(String args[]) {
CSC 480 Software Engineering
Design by Abstraction (Continuation) CS 3331 Spring 2005
Presentation transcript:

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.1 Roadmap  Generics  Abstract Factory  Annotations  Model-Driven Engineering

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.2 Design Patterns, a preview… “Each pattern describes a problem which occurs over and over again in our environment; and it describes the core of the solution to that problem, in such a way that you can use this solution a million times over…” — Christopher Alexander

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.3 Creational Patterns … deal with the best way to create objects

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.4 Abstract Factory Pattern >A Factory is the location in the code at which objects are created. >Provides an interface for creating families of related dependent objects. >Let clients create products in any family of products in an abstract way, without having to specify their concrete class. >Separates the details of implementation of a set of objects from its general usage.

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.5 Structure of the Abstract Factory Pattern AbstractFactory createProduct() ConcreteFactory1 createProduct() ConcreteFactory2 createProduct() Client AbstractProduct concreteProduct

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.6 Abstract Factory with Generics: Ludo Example package ludo; // NOTE interface for "Abstract Factory" pattern. public interface Factory { public T createInstance(); }

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.7 The Concrete Factory package ludo; public class LudoFactory implements Factory { … public Ludo createInstance() { initializeHome(); initializeBranchings(); initializeMainRing(quarterLength); initializeHomeRuns(quarterLength); initializeNests(); return new Ludo(nest); } … We specify the type to be Ludo

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.8 The Ludo Example «interface» AbstractFactory createInstance() : T LudoFactory createInstance() : Ludo Ludo «interface» Board addPlayer(Player ) …

© O. Nierstrasz, O. Greevy, A. Kuhn P2 — Clients and Servers 8.9 The Client drives the Ludo Game public class Driver implements Runnable { private Board board; public Driver(Factory factory) { this.board = factory.createInstance(); board.addPlayer(new Player()); } … public class Main { public static void main(String[] args) { Runnable gameDriver = new Driver(new LudoFactory()); gameDriver.run(); } We specify the Game Factory we want The Driver can drive any Board game