DesignImagine a client that has a request for a handler. The Chain of Responsibility pattern distances the handler from the client by passing the request along a hidden chain of handlers until one that will handle it is found.To handle a request, the handler must have the appropriate resources, knowledge, and permissions. The handlers themselves decide whether to handle a request and can do so on the basis of workload, resource limitations, policy issues, or any other good reason.The Chain of Responsibility pattern is a simple pattern in that it consists of a single, uniform interface that is implemented by multiple handlers (as many as are necessary or available). Each handler is linked in some way to a successor so that requests can be passed on if necessary. Depending on the language, the link to the successor is either internal or external to the handler itself. The UML for the Chain of Responsibility pattern is shown in Figure 8-2.
đang được dịch, vui lòng đợi..
