Design patterns – Part 4: Factory method pattern
Factory method pattern definition:
The Factory method pattern defines an interface for creating and objects, but lets subclasses to decide which class they will create.
Huh?
I will try to present this pattern on a simple example. Imagine you work in a company that sales software. However, this software is, due to different laws, different for each country/region it is sold in (in our case EU and USA). You have two types of software (Pro and Basic that differ by price and package). You will need to create a single store that will allow users to only buy products from their country. [Read the rest of this entry…]