Matt Klein 7/2/2009.  Intent  Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.

Slides:



Advertisements
Similar presentations
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Advertisements

Chain of Responsibility Pattern Gof pp Yuyang Chen.
Matt Klein. Decorator Pattern  Intent  Attach Additional responsibilities to an object by dynamically. Decorators provide a flexible alternative to.
Design Patterns David Talby. This Lecture Representing other objects Proxy, Adapter, Façade Re-routing method calls Chain of Responsibility Coding partial.
GoF Sections 2.7 – 2.9 More Fun with Lexi. Lexi Document Editor Lexi tasks discussed:  Document structure  Formatting  Embellishing the user interface.
Decorator & Chain of Responsibility Patterns Game Design Experience Professor Jim Whitehead February 2, 2009 Creative Commons Attribution 3.0 (Except for.
Computer Science – Game DesignUC Santa Cruz Announcements Website – Readings and sample code updated – Last year’s mid-term exam with answer key – Mid-term.
SWE 4743 Strategy Patterns Richard Gesick. CSE Strategy Pattern the strategy pattern (also known as the policy pattern) is a software design.
Chain of Responsibility Ian Price Dale Willey. We Will Cover What is Chain of Responsibility A few examples The Metsker Challenges.
Reza Gorgan Mohammadi AmirKabir University of Technology, Department of Computer Engineering & Information Technology Advanced design.
What is the Chain? It’s a behavioral design pattern. It deals with how objects make requests and how they are handled.
Bridge The decoupling of abstraction and implementation.
Zaki Alasadi Supervisor:Dr noorhosseini.
Button click handlers Maarten Pennings. Introduction An activity has one or more views – view is also known as widget or control – examples include Button,
BehavioralCmpE196G1 Behavioral Patterns Chain of Responsibility (requests through a chain of candidates) Command (encapsulates a request) Interpreter (grammar.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Strategy Pattern Lab 5 retrospective –Base fish provided –Specialized fish were modeled as subclasses.
Exam Questions Chain of Responsibility & Singleton Patterns Game Design Experience Professor Jim Whitehead February 4, 2009 Creative Commons Attribution.
Algorithm Programming Behavioral Design Patterns Bar-Ilan University תשס " ו by Moshe Fresko.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
GoF Sections 2.7 – 2.9 More Fun with Lexi. Lexi Document Editor Lexi tasks discussed:  Document structure  Formatting  Embellishing the user interface.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
Behavioral Patterns C h a p t e r 5 – P a g e 128 BehavioralPatterns Design patterns that identify and realize common interactions between objects Chain.
BY VEDASHREE GOVINDA GOWDA
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
Composite Design Pattern. Motivation – Dynamic Structure.
Module 15: Implementing Messaging Patterns. Overview Lesson 1: Creating Adaptable Orchestration Ports Lesson 2: Receiving Multiple Related Messages.
BDP Behavioral Pattern. BDP-2 Behavioral Patters Concerned with algorithms & assignment of responsibilities Patterns of Communication between Objects.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
“A labor of love” (Multicast Pattern) Chapter 4 (pages or ) Chris Gordon.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Behavioral Design Patterns Morteza Yousefi University Of Science & Technology Of Mazandaran 1of 27Behavioral Design Patterns.
Pattern Oriented Design Chain of Responsibility From:Design Patterns Gamma. Johnson Helm. Vlissides (GoF) Present: F 楊汝康 R 徐德皓 R 高稚翔.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
Lexi case study (Part 2) Presentation by Matt Deckard.
GoF Sections Design Problems and Design Patterns.
Chain of Responsibility Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
ECE450S – Software Engineering II
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Strategy Pattern.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Design Patterns David Talby. This Lecture Re-routing method calls Chain of Responsibility Coding partial algorithms Template Method The Singleton Pattern.
Behavioral Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Chain of Responsibility Behavioral Pattern. Defination Avoid coupling between the sender and receiver by giving more than one object a chance to handle.
Chain of Responsibility A graphical user interface and a user that needs help; a security system with multiple sensors; a banking automated coin storage.
Using Software Design Patterns Bill Anderson. About me Fox developer since 1987 Fox developer since 1987 Program Director, Los Angeles Visual Foxpro Developers.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 31. Review Creational Design Patterns – Singleton Pattern – Builder Pattern.
The State Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
The Chain of Responsibility Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
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.
The State Design Pattern A behavioral design pattern. Shivraj Persaud
COMPOSITE PATTERN NOTES. The Composite pattern l Intent Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients.
3/1/01H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
Overview of Behavioral Patterns ©SoftMoore ConsultingSlide 1.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
1/23/2018 Design Patterns David Talby.
Interface Java 7 COMP T1.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University
Behavioral Design Patterns
Observer Design Pattern
Activities and Intents
Leftover Patterns Chain of Responsibility
Design Patterns Satya Puvvada Satya Puvvada.
Behavioral Patterns Part-I introduction UNIT-VI
Behavioral Design Pattern
PH Chapter 3 Thanks for the Memory Leaks Pushme-Pullyu (pp
Strategy Design Pattern
Software Design Lecture 11.
Presentation transcript:

Matt Klein 7/2/2009

 Intent  Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it  Example  Help information on an interface  Organize from most specific to general  Pattern decouples object that initiates request from the object the ultimately provides the help

 Request is passed a long chain of objects until one handles it

 First Object receives the request and either handles it or forwards it to the next candidate  Example  User clicks help on a PrintButton within a PrintDialog

 To ensure the receivers of the request remain implicit each object must share a common interface for:  Handling Requests  Accessing its successor

 Use Chain of Responsibility when  More than one object may handle a request and the handler isn’t known a priori.  You want to issue a request to one of several objects without specifying the receiver explicitly  The Set of objects than can handle a request should be specified dynamically

 Handler (Help Handler)  Defines an interface for handling request  Optional implements the successor link  ConcreteHandler (PrintButton, PrintDialog)  Handles requests it is responsible for  Can access its successor  Forwards requests it does not handle  Client  Initiates the request to a ConcreteHandler object on the chain

 Reduced Coupling  Objects are free from knowing what object handles the request  Added Flexibility in assigning responsibilities to objects  Can change chain at runtime  Can subclass for special handlers  Receipt is guaranteed  Request could fall off the chain  Request could be dropped with bad chain

 Implementing the successor chain  Define new links  Can be handled at the base class level  Use existing links  In case like Composite, can use parent link  Sometimes redundant links are needed, if relationship structure differs

 Representing Requests  Hard coded operations  Limited in handling requests  Argument with handler  Requires conditionals  Requires packing/unpacking arguments  Separate Request Objects  Must be able to determine type in handler  Can subclass handlers

 Composite  Used with Chain of Responsibility so parent can act as a successor