计算机工程 ›› 2010, Vol. 36 ›› Issue (10): 56-57.doi: 10.3969/j.issn.1000-3428.2010.10.018

• 软件技术与数据库 • 上一篇    下一篇

责任链设计模式的改进

齐 鑫   

  1. (哈尔滨理工大学计算机科学与技术学院,哈尔滨 150080)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2010-05-20 发布日期:2010-05-20

Design Pattern Improvement of Chain of Responsibility

QI Xin   

  1. (School of Computer Science and Technology, Harbin University of Science and Technology, Harbin 150080)
  • Received:1900-01-01 Revised:1900-01-01 Online:2010-05-20 Published:2010-05-20

摘要: 传统责任链设计模式采用面向对象的程序设计标准加以实现,过多强调程序的扩展性,但没有考虑并发性、空间及时间问题,在使用过程中造成空间及时间上的浪费,降低程序处理的并发性。针对上述问题,提出一种责任链设计模式创建过程,利用延迟初始化技术减少不必要的请求处理者数量。该方法不仅维持了责任链的核心应用思想及标准实现模式,而且能够根据实际请求码,创建具体处理实例,从而提高程序的整体性能。

关键词: 设计模式, 责任链, 延迟初始化, 并发性

Abstract: Object-Oriented Programming(OOP) standard is used to implement traditional Chain of Responsibility(CoR) design pattern, which puts too much emphasis on the expansion process, without taking into account the complicated nature of space and time problem. The process causes waste of time and space greatly and reduces the treatment of complicated procedures. Aiming at the problems, a CoR creating process is presented, which uses delay initialization technology to reduce unnecessary requests for the creation of the treatment process. This method is not only a responsibility to maintain the chai’s core applications and standards for the realization of the ideological model, but also can request in accordance with the actual code, to deal with the creation of specific examples, which greatly improves the performance of the procedure.

Key words: design pattern, Chain of Responsibility(CoR), delay initialization, concurrency

中图分类号: