RKh
RKh

Reputation: 14161

When to use factory patterns?

What is this factory all about and what are the advantages of using factory patterns? Does it give a plugable architecture? Why it is called "Factory"?

Upvotes: 6

Views: 9320

Answers (2)

Adnan
Adnan

Reputation: 26350

You can find all you need by reading this PDF article

Upvotes: 3

xandy
xandy

Reputation: 27421

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.

Upvotes: 5

Related Questions