Common usages for chain of responsibility? -


i saw tutorial video explain chain of responsibility design pattern, , think understand how works i'm not sure when use it. common usages of chain of responsibility?

from gof:

known uses

several class libraries use chain of responsibility pattern handle user events. use different names handler class, idea same: when user clicks mouse or presses key, event gets generated , passed along chain. macapp [app89] , et++ [wgm88] call "eventhandler," symantec's tcl library [sym93b] calls "bureaucrat," , next's appkit [add94] uses name "responder."

the unidraw framework graphical editors defines command objects encapsulate requests component , componentview objects [vl90]. commands requests in sense component or component view may interpret command perform operation. corresponds "requests objects" approach described in implementation. components , component views may structured hierarchically. component or component view may forward command interpretation parent, may in turn forward parent, , on, thereby forming chain of responsibility.

et++ uses chain of responsibility handle graphical update. graphical object calls invalidaterect operation whenever must update part of appearance. graphical object can't handle invalidaterect itself, because doesn't know enough context. example, graphical object can enclosed in objects scrollers or zoomers transform coordinate system. means object might scrolled or zoomed it's partially out of view. therefore default implementation of invalidaterect forwards request enclosing container object. last object in forwarding chain window instance. time window receives request, invalidation rectangle guaranteed transformed properly. window handles invalidaterect notifying window system interface , requesting update.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -