Xiao Peng

My personal blog moves to xiaopeng.me , blogs about design patterns will be synced to here.
肖鹏,ThoughtWorks资深咨询师,目前关注于架构模式、敏捷软件开发等领域,并致力于软件开发最佳实践的推广和应用。
多次为国内大型企业敏捷组织转型提供咨询和培训服务,在大型团队持续集成方面具有丰富的经验。
  博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

开放性问题二(Strategy)

Posted on 2006-07-09 17:15  勇敢的鸵鸟  阅读(538)  评论(0编辑  收藏  举报

Strategy
Part 1: What happens when a system has an explosion of Strategy objects? Is there some way to better manage these strategies? Part 2: In the implementation section of this pattern, the authors describe two ways in which a strategy can get the information it needs to do its job. One way describes how a strategy object could get passed a reference to the context object, thereby giving it access to context data. But is it possible that the data required by the strategy will not be available from the context's interface? How could you remedy this potential problem?
第一部分:Strategy对象爆炸会发生什么事情?有没有更好地管理这些strategies的办法?
第二部分:在该模式的实现部分,作者描述了一个strategy对象从context对象获得所需的信息来执行自己的行为的两个方法。一个方法是向strategy对象传入context对象的引用,从而使得strategy对象可以访问context对象的数据。但是有没有可能strategy对象要求的数据无法从context对象的接口中获得?你有没有补救这个潜在问题的办法?