泛型化的策略模式设计  

Design of generalized strategy pattern

在线阅读下载全文

作  者:朱仙芝[1] 

机构地区:[1]长安大学信息工程学院,陕西西安710064

出  处:《现代电子技术》2013年第17期159-162,共4页Modern Electronics Technique

摘  要:按照GoF的"为变化进行设计"的原则,以匹配度算法的选择问题为实例,将泛型编程技术应用于策略模式设计中。首先通过对低层设计的重构,从诸多匹配度算法中抽取共有的部分,将其泛化为简单的函数对象,并用这些函数对象作为策略模式中的具体策略;再利用泛型技术构建抽象策略和上下文引用关系。这样的设计很好地解决了策略模式设计中的代码重用和泛化问题。According to the rule of "designing for change" proposed by GoF, the generic programming technique is used in strategy pattern design by taking the choice problem of matching arithmetic for example. Through refactoring the low-level de-sign, the mutual contents are extracted from a lot of matching algorithms to create the simple function-objects which is used as the concrete strategy. Then the generic technology is used to construct the abstract strategy and the reference relationship in con-text. The design has primely solved the problems of code reuse and generalization problem.

关 键 词:策略模式 重构 泛型程序设计 匹配度算法 

分 类 号:TN711-34[电子电信—电路与系统]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象