标签:blog http io ar 2014 cti log on c
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
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, factory method, abstract factory
标签:blog http io ar 2014 cti log on c
原文地址:http://www.cnblogs.com/williamwood/p/3977870.html