Amazon Interview Question

Advantage of factory pattern? Singleton class?

Interview Answer

Anonymous

Feb 10, 2011

Factory pattern has the advantage of leaving creation details to the subclass, making it more flexible. Singleton provides a single static reference and saves on complexity by being available only when necessary, saving on instantiation when only one global object is required.