Arise so let's try to summarize what we have learned about the chain of responsibility of Design Patterns
so first of all we saw different ways of implementing the chain of responsibility.
So the most basic way is when you build a chain of pointers and I suppose you could build a chain of
reference or something to that effect and what you end up with is effectively a singly linked list that
you have to walk from one site to another in order to process each of the elements in the chain one
after another.
So that is the simplest implementation but we also saw centralized implementations.
So in our case the centralized implementation was an event Broecker way you basically had a signal which
you could connect to and thereby get notification doesn't tentative of that would be if you just kept
some kind of vector or list which kept basically just a list of the elements the would all give a chance
to process something.
So basically there are two approaches.
One is kind of de-centralized and another is centralized.
That's the key difference for the chain of responsibility and what you do in either case is you have
to be able to enlist the object into the chain so you have this chain that you want to add additional
objects to it.
You might want to for example control their order so that the more important objects get put at the
start of the chain so they get to process the event or the whatever's being generated before the other
components.
A You can also sort of give them a lower order you can move them around.
You can remove them once again and removal from the chain is yet another challenge I suppose it depends
on the kind of container you have.
So if you have a vector for example you could get a bit tricky but if you have a list then everything
is just fine.
And suddenly in the case of us having for example a signal what we did is we kept that connection to
that signal and we simply disconnected from the signal when we no longer wanted to get that notification.
So to sum up the chain of responsibility can be implemented in different ways starting from very simple
pointers to something more sophisticated.
And the goal is just to let a sequence of components process some information one after another.