Common usages for chain of responsibility?

Kvass

I saw a tutorial video explain the chain of responsibility design pattern, and I think I understand how it works but I'm not sure when I would really use it. What are some common usages of the chain of responsibility?

mhcuervo

From the GoF:

Known Uses

Several class libraries use the Chain of Responsibility pattern to handle user events. They use different names for the Handler class, but the idea is the same: When the user clicks the mouse or presses a key, an event gets generated and passed along the chain. MacApp [App89] and ET++ [WGM88] call it "EventHandler," Symantec's TCL library [Sym93b] calls it "Bureaucrat," and NeXT's AppKit [Add94] uses the name "Responder."

The Unidraw framework for graphical editors defines Command objects that encapsulate requests to Component and ComponentView objects [VL90]. Commands are requests in the sense that a component or component view may interpret a command to perform an operation. This corresponds to the "requests as objects" approach described in Implementation. Components and component views may be structured hierarchically. A component or a component view may forward command interpretation to its parent, which may in turn forward it to its parent, and so on, thereby forming a chain of responsibility.

ET++ uses Chain of Responsibility to handle graphical update. A graphical object calls the InvalidateRect operation whenever it must update a part of its appearance. A graphical object can't handle InvalidateRect by itself, because it doesn't know enough about its context. For example, a graphical object can be enclosed in objects like Scrollers or Zoomers that transform its coordinate system. That means the object might be scrolled or zoomed so that it's partially out of view. Therefore the default implementation of InvalidateRect forwards the request to the enclosing container object. The last object in the forwarding chain is a Window instance. By the time Window receives the request, the invalidation rectangle is guaranteed to be transformed properly. The Window handles InvalidateRect by notifying the window system interface and requesting an update.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Chain of responsibility: loop or next?

From Dev

Modified Chain Of Responsibility

From Dev

usage of Chain of Responsibility

From Dev

Chain of responsibility in RxAndroid

From Dev

Chain of Responsibility - pass the request through all the chains

From Dev

Implementing Chain of responsibility pattern in python using coroutines

From Dev

Chain of responsibility vs Finite State Machine - differences

From Dev

Is the Chain of Responsibility pattern a good replacement for a sequence of conditions?

From Dev

Java Library for Activities/Chain-of-Responsibility with Transaction Support

From Dev

How to implement responsibility chain with different types between processing classes

From Dev

Optimize continuous deployment (cancel throu chain-of-responsibility)

From Dev

Best way to use shared components in Chain of Responsibility pattern

From Dev

Spring Boot Test - Mocking A Handler Bean That Is Placed Deep In The Chain Of Responsibility

From Dev

How can remove conditional statements while adding the common responsibility to the class?

From Dev

What is the difference between Chain Of Responsibility design pattern and using a simple if-elseif-else block?

From Dev

What is the difference between Chain Of Responsibility design pattern and using a simple if-elseif-else block?

From Dev

Are these different usages of ~?

From Dev

A future buried deep inside a chain of conditionals with a common "else" future

From Dev

A future buried deep inside a chain of conditionals with a common "else" future

From Dev

SQL server RANK () usages

From Dev

"Search for Usages" for Delphi 7?

From Dev

#line directive and real usages

From Dev

Correct usages of QOpenGLFunctions

From Dev

suchThat usages in ScalaCheck

From Dev

Restrict core usages PyCharm

From Dev

XSLT popular usages

From Dev

The Difference between to usages of SetWindowsHookEx

From Dev

Correct usages of QOpenGLFunctions

From Dev

suchThat usages in ScalaCheck

Related Related

  1. 1

    Chain of responsibility: loop or next?

  2. 2

    Modified Chain Of Responsibility

  3. 3

    usage of Chain of Responsibility

  4. 4

    Chain of responsibility in RxAndroid

  5. 5

    Chain of Responsibility - pass the request through all the chains

  6. 6

    Implementing Chain of responsibility pattern in python using coroutines

  7. 7

    Chain of responsibility vs Finite State Machine - differences

  8. 8

    Is the Chain of Responsibility pattern a good replacement for a sequence of conditions?

  9. 9

    Java Library for Activities/Chain-of-Responsibility with Transaction Support

  10. 10

    How to implement responsibility chain with different types between processing classes

  11. 11

    Optimize continuous deployment (cancel throu chain-of-responsibility)

  12. 12

    Best way to use shared components in Chain of Responsibility pattern

  13. 13

    Spring Boot Test - Mocking A Handler Bean That Is Placed Deep In The Chain Of Responsibility

  14. 14

    How can remove conditional statements while adding the common responsibility to the class?

  15. 15

    What is the difference between Chain Of Responsibility design pattern and using a simple if-elseif-else block?

  16. 16

    What is the difference between Chain Of Responsibility design pattern and using a simple if-elseif-else block?

  17. 17

    Are these different usages of ~?

  18. 18

    A future buried deep inside a chain of conditionals with a common "else" future

  19. 19

    A future buried deep inside a chain of conditionals with a common "else" future

  20. 20

    SQL server RANK () usages

  21. 21

    "Search for Usages" for Delphi 7?

  22. 22

    #line directive and real usages

  23. 23

    Correct usages of QOpenGLFunctions

  24. 24

    suchThat usages in ScalaCheck

  25. 25

    Restrict core usages PyCharm

  26. 26

    XSLT popular usages

  27. 27

    The Difference between to usages of SetWindowsHookEx

  28. 28

    Correct usages of QOpenGLFunctions

  29. 29

    suchThat usages in ScalaCheck

HotTag

Archive