Chain of Responsibility Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.

Slides:



Advertisements
Similar presentations
1 Symbian Client Server Architecture. 2 Client, who (a software module) needs service from service provider (another software module) Server, who provide.
Advertisements

Operating-System Structures
Chain of Responsibility Pattern Gof pp Yuyang Chen.
Visual Basic: An Object Oriented Approach 2 – Designing Software Systems.
JDBC Session 4 Tonight: Design Patterns 1.Introduction To Design Patterns 2.The Factory Pattern 3.The Facade Pattern Thursday & Next Tuesday: Data Access.
Observer Method 1. References Gamma Erich, Helm Richard, “Design Patterns: Elements of Reusable Object- Oriented Software” 2.
Design Patterns Section 7.1 (JIA’s) Section (till page 259) (JIA’s) Section 7.2.2(JIA’s) Section (JIA’s)
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Design Patterns Copyright © Vyacheslav Mukhortov, Nikita Nyanchuk-Tatarskiy, Copyright © INTEKS LLC,
DESIGN PATTERNS OZGUR RAHMI DONMEZ.
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 of Responsibility Ian Price Dale Willey. We Will Cover What is Chain of Responsibility A few examples The Metsker Challenges.
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
What is the Chain? It’s a behavioral design pattern. It deals with how objects make requests and how they are handled.
Zaki Alasadi Supervisor:Dr noorhosseini.
Network Management 2 School of Business Eastern Illinois University © Abdou Illia, Spring 2007 (Week 16, Thursday 4/19/2007)
THE OBJECT-ORIENTED DESIGN WORKFLOW Interfaces & Subsystems.
BehavioralCmpE196G1 Behavioral Patterns Chain of Responsibility (requests through a chain of candidates) Command (encapsulates a request) Interpreter (grammar.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Algorithm Programming Behavioral Design Patterns Bar-Ilan University תשס " ו by Moshe Fresko.
Chapter 8 Object Design Reuse and Patterns. Finding Objects The hardest problems in object-oriented system development are: –Identifying objects –Decomposing.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Command Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Chapter 6 - Implementing Processes, Threads and Resources Kris Hansen Shelby Davis Jeffery Brass 3/7/05 & 3/9/05 Kris Hansen Shelby Davis Jeffery Brass.
Overview of simple LANs. Networking basics: LAN TCP/IP is the protocol used in the Internet and dominates the internet and transport layers The subnet.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Computer Networks IGCSE ICT Section 4.
Proxy Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Basic Networking Components
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.
Observer Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
1 The Firewall Menu. 2 Firewall Overview The GD eSeries appliance provides multiple pre-defined firewall components/sections which you can configure uniquely.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Patterns and Reuse. Patterns Reuse of Analysis and Design.
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.
Team 6 “The Unparseables” Design Patterns Chain of Responsibility Observer Flyweight 1.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
DESIGN PATTERNS -BEHAVIORAL PATTERNS WATTANAPON G SUTTAPAK Software Engineering, School of Information Communication Technology, University of PHAYAO 1.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
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.
Design Reuse Earlier we have covered the re-usable Architectural Styles as design patterns for High-Level Design. At mid-level and low-level, design patterns.
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.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 31. Review Creational Design Patterns – Singleton Pattern – Builder Pattern.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 9: Design Engineering Software Engineering: A Practitioner’s Approach, 6/e Chapter.
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.
The Chain of Responsibility Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
I/O Software CS 537 – Introduction to Operating Systems.
Layers Architecture Pattern Source: Pattern-Oriented Software Architecture, Vol. 1, Buschmann, et al.
Software Defined Networking and OpenFlow Geddings Barrineau Ryan Izard.
Ch. 31 Q and A IS 333 Spring 2016 Victor Norman. SNMP, MIBs, and ASN.1 SNMP defines the protocol used to send requests and get responses. MIBs are like.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
FIREWALLS By k.shivakumar 08k81f0025. CONTENTS Introduction. What is firewall? Hardware vs. software firewalls. Working of a software firewalls. Firewall.
Introduction to Operating Systems Concepts
Software Design Refinement Using Design Patterns
Chapter 10 Design Patterns.
Observer Design Pattern
Leftover Patterns Chain of Responsibility
Introduction to Networking
Advanced Programming Behnam Hatami Fall 2017.
Behavioral Patterns Part-I introduction UNIT-VI
Behavioral Design Pattern
Requirements Definition
Presentation transcript:

Chain of Responsibility Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.

Problem Calling a method tightly couples the sending and receiving objects –Requires the caller to know which object should perform the operation This is usually not a problem, but sometimes … –You need an operation performed –There are multiple objects that can perform it –The object that should perform the operation changes over time and depends on the context, and the caller doesn’t know which object to call You need a way to call a method without specifically saying which object should perform the operation

Solution Decouple sender and receiver by giving multiple objects a chance to handle a request When the sender needs to perform an operation, the request is passed along a chain of objects until one of them handles it The result is passed back along the chain to the sender The sender doesn't even know which object processed the request Any object that wants a chance to handle requests is added to the chain

Solution

Known Uses: UI Event Handling User interfaces are implemented as composites (i.e., trees) of "widgets"

Known Uses: UI Event Handling Events are handled bottom-up The chain of responsibility includes the leaf-level widget where the event begins and its ancestors Context-sensitive help can be handled the same way –ProcessHelp() instead of ProcessEvent()

Known Uses: Network Device Classification

When a device is discovered on a network, how do we figure out what kind of device it is (Windows, Linux, Mac, Printer, Switch, Router, etc.)? There are many heuristic algorithms one might use to “classify” a device –Query the device for information about itself using various network protocols (e.g., SNMP, WMI, …) –Determine vendor based on the device’s MAC address (e.g., Apple owns certain MAC address ranges) –Try to SSH into the device and figure out what it is –Etc. For any given device, some of these heuristic algorithms will work, and some won’t.

Known Uses: Network Device Classification Each heuristic algorithm is implemented by a different class called a “classifier” All of the classifier objects are linked in a “chain of responsibility” To classify a device, pass the device down the chain of classifiers until one of them figures out what the device is

public class PrinterClassifier : Classifier { public PrinterClassifier(Classifier successor) : base(successor) { return; } public DeviceType ClassifyDevice(Device device) { if (device exhibits printer characteristics) return DeviceType_Printer; else if (successor != null) return successor.ClassifyDevice(device); else return DeviceType_Unknown; } public abstract class Classifier { private Classifier successor; protected Classifier(Classifier successor) { this.successor = successor; } public Classifier Successor { get { return successor; } } public abstract DeviceType ClassifyDevice(Device device); }