simple factory, factory method, abstract factory
2014-09-17 19:17
447 查看
simple factory
good:
1 devide implementation and initialization
2 use config file can make system more flexible (reflection)
bad:
1 all initialization work in factory. when the logic is complex or too many products, the factory will be too complex.
hard to maintain.when can, the reflection can solve the issue of too many products.
2 extention not easy. when we want to add new product, the existing souce code of factory class should be modified.
when to use:
1 the factory does not have many products.
2 client does not care the details of the initialization
factory method
good:
1 factory can decide which product to create. The poli allow us not to modify client code when we want to add new product
bad:
1 system is complex.new factory class added.
abstract factory
good:
1 easy to add new products
2 add all products related at one time
bad:
1 very hard to add new hiracy of product
相关文章推荐
- Simple Factory vs. Factory Method vs. Abstract Factory【简单工厂,工厂方法以及抽象工厂的比较】
- 简单工厂模式(Simple Factory)和工厂方法模式(Factory Method)和AbstractFactory ( 抽象工厂 )
- [C#]我的实用设计模式之四-Simple Factory,Factory Method和Abs
- 设计模式一 - Simple Factory, Factory Method, Abstract Factory以及Builder模式简述
- 简单工厂模式(Simple Factory) vs 工厂方法模式(Factory Method)
- [创建型模式系列]simple factory & factory method 简单工厂类和工厂方法类的概念及区别
- 简单工厂模式 (Simple Factory Pattern) / 静态工厂方法(Static Factory Method)模式
- [重构到模式-Simple Factory\Factory Method\Abstract Factory]包子铺系列招式
- SimpleFactory Pattern,MethodFactory Pattern and AbstrctFactory Pattern
- Simple Factory Vs Factory Method Vs Abstract Factory by Example
- Java语言 封装创建 简单工厂方法(Simple Factory method)
- SimpleFactory Pattern,MethodFactory Pattern and AbstrctFactory Pattern
- 『创建型』简单工厂SimpleFactory、工厂方法FactoryMethod、抽象工厂AbstractFactory
- 三个工厂模式(Simple Factory & Factory Method & Abstract Factory)
- 一、简单工厂模式(simple factory method)
- 简单工厂模式(Simple Factory Method Pattern)
- 『创建型』简单工厂SimpleFactory、工厂方法FactoryMethod、抽象工厂AbstractFactory
- "Simple Factory" vs "Factory Method" vs "Abstract Factory" vs "Reflect"
- 简单工厂方法 SimpleFactoryMethod
- Java 简单工厂模式(Simple Factory Pattern)又叫静态工厂方法模式(Static FactoryMethod Pattern)