Chain of Responsibility
Learn about a behavioral design pattern: chain of responsibility.
We'll cover the following...
Chain of responsibility is a behavioral pattern. We are going to take another look at our event systems. We want to parse information about the events that happened on the system from the log lines (text files, dumped from our HTTP application server, for example), and we want to extract this information in a convenient way.
Press + to interact
Using the chain of responsibility pattern
Previously, we achieved an interesting solution that was compliant with the open/closed principle and relied on the use of the __subclasses__()
magic method to discover all possible event types and process the data with the right event, resolving the responsibility ...