Design Patterns curriculum design model is simple 4-1 factory succinctly explain

1 The course explains

1.1 Definitions

1.2 Application of this scenario

1.3 advantage

1.4 shortcomings





1 The course explains
1.1 Definitions

Determined by a factory object to create an instance of what kind of product class.

 

1.2 Application of this scenario

3.1 Object factory class is responsible for creating relatively small;
3.2 client only knows the parameters passed factory class, how to create objects do not care.

 

1.3 advantage

Only need to pass in a parameter, you can get a subject in need, without knowing the details of creating

 

1.4 shortcomings

a duty factory class heavy, adding new products, need to modify the factory class determination logic, contrary to the principle of opening and closing ;
B can not form a hierarchical structure based on inheritance.

Guess you like

Origin www.cnblogs.com/1446358788-qq/p/11257820.html