官术网_书友最值得收藏!

Abstract Factory

Abstract Factory is a greatly misunderstood pattern. It has a notorious reputation for being very complex and bizarre but actually, it's quite simple. If you understood the Factory Method, you'll understand this one in no time. This is because Abstract Factory is a factory of factories. That's all there is to it, really. The factory is a function or class that's able to create other classes. Abstract Factory is a class that creates factories.

You may understand that and still wonder what the usages of such a pattern may be. The main usage of Abstract Factory in the real world would probably be frameworks, most notably Spring Framework, which uses the notion of Abstract Factory to create its components out of annotations and XML files. But since creating our own framework may be quite tiresome, let's take another example where this pattern will be very useful—a strategy game.

We'll call it CatsCraft 2: Revenge of the Dogs.

主站蜘蛛池模板: 泸州市| 墨脱县| 策勒县| 将乐县| 英吉沙县| 合水县| 墨江| 绥芬河市| 衡南县| 左云县| 平原县| 宣武区| 黑河市| 游戏| 方正县| 景宁| 平和县| 明溪县| 扎鲁特旗| 武川县| 枣阳市| 花垣县| 蓬溪县| 兰州市| 乐东| 连江县| 宁阳县| 大荔县| 东港市| 日喀则市| 禹州市| 垫江县| 新营市| 宜兴市| 隆德县| 肃北| 通榆县| 天门市| 杭州市| 武夷山市| 开化县|