ChainOfResponsibility

ChainOfResponsibility - Chain of Responsibility Design...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Chain of Responsibility Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
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
Background image of page 2
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
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/02/2012 for the course C S 340 taught by Professor Woodfield,s during the Winter '08 term at BYU.

Page1 / 10

ChainOfResponsibility - Chain of Responsibility Design...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online