I think it's fair to say that they are quite similar to each other.
The only difference that I know is the intent.
Chain of Responsibility: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. Not all objects may get chance or be able to handle the request.
Decorator : Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. All decorator objects handle the request by enhancing the data in their own way.
But is there a difference if implementation? Apart from the fact that in Chain of responsibility you could break the chain at any point?
The following is an example of Decorator Pattern. But if you had asked me to write an example of Chain of responsibility, I could have written the same example.
Yes I could have also added the condition where I check if the request is to be forwarded further and then break the chance if not. But is that a mandatory thing for it to qualify as a Chain of Responsibility Pattern? If it's not then is the following not an example of both Chain of Responsibility and Decorator pattern?
This parrot is no more. It has ceased to be. Now it's a tiny ad: