Design Pattern Dr. Zhen Jiang West Chester University url:

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
CS590L - Lecture 6 1 CS590L Distributed Component Architecture References: - E. Gamma, R. Helm, R. Johnson, J. Vlissides, Design Patterns: Elements of.
Patterns Reusable solutions to common object-oriented programming problems When given a programming problem, re-use an existing solution. Gang of Four.
Design Patterns Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
Design Patterns A brief introduction to what they are, why they are useful, and some examples of those that are commonly used.
Nov, 1, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and its.
IEG3080 Tutorial 7 Prepared by Ryan.
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.
Oct, 16, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing.
BDP Behavioral Pattern. BDP-2 Behavioral Patters Concerned with algorithms & assignment of responsibilities Patterns of Communication between Objects.
Design Patterns.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
UML - Patterns 1 Design Patterns. UML - Patterns 2 Becoming Good OO Developers Developing good OO Software is hard Takes a lot of time to take advantage.
Mediator Pattern and Multiuser Protection Billy Bennett June 8 th, 2009.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
DESIGN PATTERNS CSC532 Adv. Topics in Software Engineering Shirin A. Lakhani.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Computing IV Singleton Pattern Xinwen Fu.
Object Oriented Software Engineering Chapter 16 and 17 review 2014/06/03.
CSE 403 Lecture 14 Design Patterns. Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
Methods: Deciding What to Design In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT. icu.ac.kr Fall 2005 ICE0575 Lecture.
ECE450S – Software Engineering II
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared.
Creational Patterns
What to know for the exam. Smalltalk will be used for questions, but there will not be questions about the grammar. Questions might ask – how particular.
FACTORY METHOD. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
Java Design Patterns Java Design Patterns. What are design patterns? the best solution for a recurring problem a technique for making code more flexible.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
Interface Patterns. Adapter Provides the interface a client expects, using the services of a class with a different interface Note Avoid using object.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
CSE 332: Design Patterns (Part II) Last Time: Part I, Familiar Design Patterns We’ve looked at patterns related to course material –Singleton: share a.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
7 April 2004CSci 210 Spring Design Patterns 2 CSci 210.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Jim Fawcett CSE776 – Design Patterns Summer 2006
Design Patterns A brief introduction to what they are, why they are useful, and some examples of those that are commonly used.
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
Software Design Patterns
Structural Patterns Structural patterns control the relationships between large portions of your applications. Structural patterns affect applications.
MPCS – Advanced java Programming
Common Design Patterns
Design Patterns Lecture part 2.
Introduction to Design Patterns
How to be a Good Developer
Design Patterns with C# (and Food!)
object oriented Principles of software design
Software Engineering Lecture 7 - Design Patterns
Design Patterns in Game Design
Informatics 122 Software Design II
Design Patterns Part 2: Factory, Builder, & Memento
Structural Patterns: Adapter and Bridge
Informatics 122 Software Design II
CIS 644 Tues. Nov. 30, 1999 W15A … patterns.
Presentation transcript:

Design Pattern Dr. Zhen Jiang West Chester University url:

Outline Introduction Creational Patterns Structural Patterns Behavioral Patterns

Introduction A design pattern names, abstracts, and identifies the key aspects of a common design structure that make it useful for creating a reusable object- oriented design Creational design patterns abstracts the instantiation process Structural patterns are concerned with how classes and objects are composed to form larger structures. Behavioral patterns are concerned with algorithms and assignment of responsibilities between objects.

Creational Pattern Abstract factory Builder Factory Method Prototype Singleton

Abstract Factory Client WidgetFactory Motif Consider a user interface (client, windows and ScrollBar) that supports (creates) multiple look- and-feel standards. PMW Windows PMWMotif ScrollBar PMWMotif ?

Abstract Factory Client AbstractFactory Factory1Factory2 ProductA PA2PA1 ProductB PB2PB1

Abstract Factory Shopping, interlibrary, …

Builder Reader/User Add a new conversion? Converter ACSWidget TextPicture

Builder Reader/User Builder ConcreteBuilder Product

Builder Add a new tool, new course, new equipment, …

Factor Method For creating objects Drink, Drug, vegetables, gardening, … Creator Product ConcreteProduct ConcreteCreator

Prototype Provide an abstract tool for defining items like those in the palette. Windows creation Prototype Client movement clone Prototype1 clone Prototype2 clone

Singleton For some classes to have exactly one instance Examples?

Structural Pattern Adapter Bridge Composite Decorator Façade Flyweight Proxy

Adapter For existing and unrelated classes working in an application that expects classes with a different and incompatible interfaces (Builder?) Unix process, file system, … Target Client Adapter request Adaptee implementation

Bridge Inheritance binding (Builder? AbstractFactory?) Windows (their structure and implementation), Database? RefinedAbstraction Abstraction Implementor IAIB

Composite Group components Component LeafComposite

Composite aComposite(is aComponent) aComponent aLeaf aComposite aComponent aLeaf

Decorator Specifying the responsibility of certain group, build an transparent interface to component’s client Teaching, GA, and Instructor Component LeafDecorator DADB ops

Facade Simplifying interface to more general facilities of subsystems. (AbstractFactory, FactorMethod, Bridge) Current screen status of Windows? Facade

Flyweight For sharing resource Client FlyWeight ConcreteFlyWeight

Flyweight aClient aFlyWeight aCF

Flyweight Paragraph and Keys of keyboard?

Proxy Access control and reference Subject RealSubject Proxy aClient aProxy aRS

Proxy Network Service?

Behavioral Pattern Chain of Responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor

Chain of Responsibility Decouple senders and receivers (sequence? ) Steps, courses, … Handler aHandler

Command Request, command, …? Dos/Shell command, file I/O, user interface, …? InvokerCommand ConcreteCommandReceiver

Interpreter Grammar Composite? Formal language L=a|bC; C=e|cC. (sample statement: a, b, bc, bcc, …

Iterator Access without exposing any internal structure Interface FactorMethod

Mediator Distribution of behavior among objects AbstractFactory Mediator ConcreteMediator Colleague CC1CC2

Memento Record the internal state (checkpoints) Tests of course, firewall, …? OriginatorMemento Caretaker

Observer Maintain consistency Observer calls Getstatus( ) Ordering, TCP communication, … Subject ConcreteSubject Observer ConcreteObserver

State Conditional statements Used in Command, Memento, Observer, … Project, study, …, Context State ConcreteStateA ConcreteStateB

Strategy Builder, Prototype, Bridge, Command, State. Hollywoodsquare, Chess, searching and sorting (for example, shell), … Context Strategy ConcreteStrategyA ConcreteStrategyB

Template Method A template method defines an algorithm in terms of abstract operations that subclasses override to provide concrete behavior Inheritance (generalization), virtual function Operations (searching and sorting) in Template class (Template Stack, Template Queue). AbstractClass ConcreteClass

Visitor Packaging related operations from each class in a separate object, called a visitor, and passing it to elements of the abstract syntax tree as it’s traversed. Visitor ConcreteVisitorA ConcreteAcceptA ConcreteAcceptB ConcreteAcceptA ConcreteVisitorB ConcreteAcceptB