• Encapsulates class instantiation in a method. • Lets subclasses decide which class to instantiate. Allows to: • extract complex object creation code, • select which class to instantiate, • cache objects.
from its receiver. • The request is processed by the chain until some object handles it. Allows to: • give more than one object a chance to handle the request.
http://www.flickr.com/photos/shoesfullofdust/3999374824/, available under a Creative Commons Attribution 2.0 Generic license: http://creativecommons.org/licenses/by/2.0/
to substitute dependencies. Allows to: • choose among multiple implementations of a particular component, • use mock implementations during unit testing.