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

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.

主站蜘蛛池模板: 美姑县| 应用必备| 石泉县| 如皋市| 新疆| 通化市| 河南省| 侯马市| 福泉市| 遂川县| 南通市| 玉山县| 屏东县| 清河县| 义乌市| 满洲里市| 凤翔县| 海淀区| 岳西县| 耒阳市| 眉山市| 抚宁县| 颍上县| 榆树市| 辽源市| 库伦旗| 普洱| 临安市| 公主岭市| 清丰县| 吴桥县| 盐池县| 山西省| 德令哈市| 若羌县| 什邡市| 临沂市| 阿荣旗| 渭南市| 赤壁市| 铁力市|