Skip to main content

Posts

Showing posts from February 13, 2018

Chain of responsibility design pattern

Greetings! In this behavioral design pattern, request is handled using a chain of objects. This is used to eliminate series of if...else if...else if... statements. Thus, each of the processing object contains only the related logic (as in an if statement). It is also possible to execute all the processing objects. Since the chain work independently new handlers can be added easily, and also existing handlers can be removed. Image source wikipedia Let's see a sample.