Behavioral patterns refer to how objects are designed to collaborate and communicate with each other. There are 11 GoF patterns from the OOP paradigm. We will cover all of them here with some interesting hands-on examples.
Behavioral patterns
The chain-of-responsibility pattern
The chain-of-responsibility (CoR) pattern is used to process the request using a chain of request handlers, whereas each handler has its own distinct and independent responsibility.
This pattern is quite common in many applications. For example, web servers usually handle HTTP requests using so-called middleware. Each piece of middleware is responsible for performing a specific task—for example, authenticating requests, maintaining cookies...