摘要
设计模式使得设计人员可以更加简单方便地复用成功的设计和体系结构,帮助设计人员做出有利于系统复用的选择,避免设计损害系统的复用性。责任链模式将处理用户请求的对象形成一个链,责任链上的每个处理者要么处理用户的请求,要么把请求传递给责任链上的下一个处理者。将策略模式嵌入到责任链模式中形成一种复合模式,设计的核心是为责任链上的每个处理者配备若干个策略,使得处理者可以使用多个策略应对用户的请求,增强了责任链模式处理用户请求的能力和灵活性。
Design patterns make it easier to reuse successful designs and architectures, help software designer to choose design altematives that make a system reusable and avoid alternatives that compromise reusability. The chain of responsibility pattern let these object which can handle the request of customer become to a chain,and a handler of the responsibility chain handles the request of a customer or deliver the request of a customer to next handler of the chain of responsibility. In this paper, let the strategy pattern be embedded to the chain of responsibility pattern to become a kind of compound pattern. It is an essential part that a handler is provided some strategies, so that a handler can handle the request of a customer by using a strategy in these strategies. The compound pattern make the ability and flexibility of the chain of responsibility pattern be strengthen.
出处
《计算机技术与发展》
2009年第6期55-57,共3页
Computer Technology and Development
基金
辽宁省高等学校研究计划项目(05L040)
关键词
责任链模式
策略模式
复合模式
chain of responsibility pattern
strategy pattern
compound pattern