The chain of responsibility design pattern
Nowadays, with the growth of data sizes and the hype around Big Data, stream processing is something that many applications will have to be able to do. Stream processing is characterized by an endless stream of data, which is passed from one object to another while each of them could be doing some processing and then passing it on to the next one. In other cases, data could be moved on in the chain until it arrives at an object which knows how to process a certain command.
The preceding behavior is really suitable for the chain of responsibility design pattern. The purpose of chain of responsibility is to:
Note
Decouple the sender of a request from its receiver by giving multiple objects the chance to handle the request.
There could be some variations to the chain of responsibility design pattern. The original pattern is that whenever a request reaches an object that can process it, it doesn't go any further. However, in some cases, we might need to...