我要去米国吧 关注:11贴子:2,508
  • 1回复贴,共1

Design Pattern

只看楼主收藏回复



1楼2015-06-21 22:49回复
    Abstract Factory

    效果:
    1. Isolates concrete class
    2. Makes exchanging product families easy
    3. Promotes consistency among products
    4. Supporting new kinds of products is difficult
    实现:
    1. Factories as singletons.
    2. Createing the product.The most common way to do this is to define a factory method for each product. If many product families are possible, the concrete factory can be implemented using Prototype pattern.
    3. Defining extensible factories. Abstract factory usually defines a different operation for each kind of product it can produce. A more flexible but less safe design is to add a parameter to operations that create objects.


    4楼2015-06-21 23:33
    回复