http://www.oodesign.com/flyweight-pattern.html
Some programs require a large number of objects that have some shared state among them.例如一个游戏中的士兵,创建大量士兵对象将消耗大量内存。但是我们可以发现:每个士兵的位置和health各有不同,但是持有的武器,行进速度等很多特性都是相同的。
Flyweight模式处理的问题就是:
The intent of this pattern is to use sharing to support a large number of objects that have part of their internal state in common where the other part of state can vary.
本文探讨了Flyweight模式如何处理大型应用程序中具有部分内部状态共通的大量对象问题,通过共享机制有效减少内存消耗,提高性能。
1514

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



