命令模式

在面向对象编程的范畴中,命令模式是一种设计模式,它尝试以对象来代表实际行动。命令对象可以把行动(action) 及其参数封装起来,于是这些行动可以被:
- 重复多次
- 取消(如果该对象有实作的话)
- 取消后又再重做
这些都是现代大型应用程序所必须的功能,即「复原」及「重复」。除此之外,可以用命令模式来实作的功能例子还有:
- 交易行为
- 进度列
- 精灵
- 用户接口按钮及功能表项目
- 线程 pool
- 巨集收录
单词 | Command pattern |
释义 |
Command pattern
中文百科
命令模式![]() 在面向对象编程的范畴中,命令模式是一种设计模式,它尝试以对象来代表实际行动。命令对象可以把行动(action) 及其参数封装起来,于是这些行动可以被:
这些都是现代大型应用程序所必须的功能,即「复原」及「重复」。除此之外,可以用命令模式来实作的功能例子还有:
英语百科
Command pattern 命令模式In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters. |
随便看 |
|
英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。