Chain of Responsibility - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Chain of Responsibility

Description:

In each case, don't need to know or care ahead of time. Another example ... But only one coinslot. Benefits ... Further discussion. Other examples? Problems? Is ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 8
Provided by: lorenss
Category:

less

Transcript and Presenter's Notes

Title: Chain of Responsibility


1
Chain of Responsibility
  • Loren Shevitz
  • 28 Jan 02

2
What is it?
  • Behavioral pattern
  • Passes the buck
  • Defecit spending

3
When to use?
  • Single superclass of requests with different
    problems
  • Not sure which object will eventually handle
    request
  • Each request can be processed same way initially

4
Examples
  • The Ubiquitous Fruit
  • Lets eat! But first
  • class Fruit peel()
  • Consider
  • Pineapple slice open with knife
  • Orange fingernail.puncture()
  • Grape
  • In each case, dont need to know or care ahead of
    time

5
Another example
  • From http//home.earthlink.net/huston2/dp/chain.h
    tml
  • Coins
  • Quarter, dime, nickel, penny, half-dollar, Ike
    dollar, Brass Buck all sorted.
  • But only one coinslot

6
Benefits
  • Eliminates need for hard-coding the relationship
    between request-maker and handler
  • As with previous patterns, allows for greater
    readability and tweaking
  • Another elaborate name for relatively simple
    process

7
Further discussion
  • Other examples?
  • Problems?
  • Is 14.5 too high?
Write a Comment
User Comments (0)
About PowerShow.com