using design patterns to create reusable & maintainable code
Design Pattern Primer: The Factory
When writing object oriented code we end up needing to create a lot of different objects. Sometimes the process to create those objects is complex or maybe we don't know exactly which type we will need to create. Situations like these are where using the Factory pattern comes in handy.