Reputation: 963
What is the difference of the Pipe-Filter and the Chain-of-Responsibility pattern.
It seems for me that the two patterns are very similar if not even the same. But maybe I miss something.
Thx
Upvotes: 1
Views: 4453
Reputation: 8860
These are completely different. In "Pipes and filters" you divide your complex algorithm into small chunks, which are executed in series - as a "pipeline". First one multipliers, next one takes the multiplied value and calculates the square, third one takes the multiplied and squared value and adds 10, and so on...
http://en.wikipedia.org/wiki/Pipeline_%28software%29
In "Chain of Responsibility" you divide you "application" into small handlers, each doing one specific thing in response to the command(s) that trigger it. You connect them in the chain and pass the command to the first one, which either executes it (if it handles this particular one), or passes it "down the chain" - to the next object. So if you pass command "print status", it is passed to the first object, which (for example) passes it down, because it handles only "exit" commands, the next object also passes it, because it handles (for example) "abort" command, this repeats until one of objects in the chain decides to handle this command (or until the chain ends).
http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern
Upvotes: 13