August 2016
Intermediate to advanced
635 pages
14h 5m
English
We've already looked at the Abstract Factory and a builder. The Abstract Factory builds a family of related classes and the builder creates complicated objects using different strategies. The factory method pattern allows a class to request a new instance of an interface without the class making decisions about which implementation of the interface to use. The factory may use some strategy to select which implementation to return:

Sometimes this strategy is simply to take a string parameter or to examine some global setting to act as a switch.
In our example world of Westeros there are plenty of times when we would like ...