开发者

When to use factory patterns?

开发者 https://www.devze.com 2023-01-23 02:46 出处:网络
What is this factory all about and what are the advantages of using fact开发者_开发百科ory patterns? Does it give a plugable architecture? Why it is called \"Factory\"?It is factory since it is actual

What is this factory all about and what are the advantages of using fact开发者_开发百科ory patterns? Does it give a plugable architecture? Why it is called "Factory"?


It is factory since it is actually "Manufacturing" (Create) an object.

There's actually two kind of factory pattern defined by GoF:

  1. Factory Method
  2. Abstract Factory

Basically both of them tries to decouple the calling client from knowing the actual concrete implementation of the class/interface.


You can find all you need by reading this PDF article

0

精彩评论

暂无评论...
验证码 换一张
取 消