design patterns

Chain of Responsibility - C++

Yesterday, I somewhat implemented the Chain of Responsibility design pattern in C++. This was because I grew tired of writing code that constantly called into some C library, checked an error code, and continued on to call another function IF the error was not present. This lent itself naturally (in my opinion) to a Chain of Responsibility pattern, though I may not have implemented it perfectly. Chain of Responsibility This design pattern can be boiled down to one idea: a chain of handlers working together to form a “super” handler of sorts.