Benefits:
• It separates the object that invokes the operation from the object that actually performs the operation.
• It simplifies adding new commands, because existing classes remain unchanged.
Applicable Scenarios:
• You need to parameterize objects according to an action to perform.
• You create, queue, and execute requests at different times.
• You need to support rollback, logging, or transaction functionality.
博客介绍了一种模式的好处和适用场景。好处是将调用操作的对象与实际执行操作的对象分离,且添加新命令时不改变现有类。适用场景包括按操作参数化对象、不同时间创建和执行请求,以及需要支持回滚、日志或事务功能。
7万+

被折叠的 条评论
为什么被折叠?



