This is an outline of the topic. I will revisit this topic latter and expand on this outline.
What are Design Patterns? They are different styles of programming to help with the constant change, modification, addition, and scrapping of features, functionality, and structure of a code base.
The Factory Pattern is one of the most commonly used (Purdy, 2002). But what is the Factory pattern, well lets find out!
The logical model.
Factory’s are an object designed to wrap the actualization if the instantiation process up inside the factory. The Client orders a Product from the Factory instead of instantiating it directly. This abstracts the client from the objects production method. This way if their is ever a need to change the production method, all other interactions remain unaffected.
The Physical Model
The implementation is commonly enacted through the creation of two abstract classes these being the AbstractProduct and the AbstractFactory and then inherting from these are the concrete classes ConcreteProduct and ConcreteFactory The reason for these two layers is that the abstract classes can be used as the interaction much like an interface, while the concrete classes are the implementation of the production method, opening up the possibility for as many concrete classes as are needed, this will also allow endless possibility for the aforementioned modifications that are often ongoing throughout development and post development of a project.
Purdy, D. (2002). Exploring the Factory Design Pattern. [online] Msdn.microsoft.com. Available at: https://msdn.microsoft.com/en-us/library/ee817667.aspx [Accessed 5 Mar. 2018].