Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chain of Responsibility Pattern [GoF]

 
Victor M. Pereira
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm studying the gang of four book to add more patterns to what I know. And I've stumbled across the chain of responsibility pattern.

From what I read from the book and the internet. I saw two different approaches:

1) Traverses whole tree of successions and applies every handle that can do something with the data. This seemed like a if applicable decorate.

2) This one was traverse the tree until someone can do something about it, if it ends have a default.

The main problem is that I can't see myself using them. Since, most internet examples aren't really CoR but some mock of Strategy. In what cases can I really say
this is without a doubt CoR (Chain of Responsibility).
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet filters come to mind as an example of this pattern in practice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic