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对象的接口中获得?你有没有补救这个潜在问题的办法?