I've just finished working my way through the Head First Design Patterns book and I noticed that the chain of responsibility pattern is "Commonly used in windows systems to handle events like mouse clicks and keyboard events."
To what extent is this pattern used for these events and in what way?
I understand that the chain of responsibility pattern can act like a sort of filter, but what exactly would be filtered? Or in other words what different ways might these events be handled by the chained objects?
The first thing that comes to mind is some sort of mapping system but that doesn't seem to likely, and would surely be pretty inefficient?
Perhaps something to do with combinations of keys (Ctrl + Alt + Del etc.)?
Maybe I'm missing something obvious or have misunderstood something, but it's not instantly apparent to me why this pattern would be useful in this situation.
Aucun commentaire:
Enregistrer un commentaire