Benefits:
- Eliminates the need to bind application classes into your code (Code deals only with interfaces)
- Enables the subclasses to provide an extended version of an object, because creating object inside a class is more flexible than creating object directly in the client
When to use:
- A class cannot anticipate the class of objects it must create
- A class wants its subclasses to specify the objects it creates
- Classes delegate responsibility to one of several helper subclasses, and you want to localise the knowledge of which helper subclass is the delegate.

No comments:
Post a Comment