posted 19 years ago
I am going to assume you know how to google and that you are rather looking for a point of view that you can interact with. Moreover, every question on this forum could be preceded by "you can get information from google"; so it is pointless to suggest that.
Factory methods insulate your application from custom code. Creating custom versions of an application is therefore simplified.
Assume you have several customers and they all have specialized needs. Sprinkling your code with conditional statements everywhere there was a customer variance would create a maintenance nightmare. Instead, you can capture variances in a class or set of classes with a standard interface. Factory methods are then used to select the appropariate sub-type at runtime. The rest of your application is unaware that it's running a specialized version of the application. The same application can support an infinite variety of implementations withou change.
Note that you still have the conditional statement that decides which class to instantiate, however, it's all neatly packaged inside a factory method that creates