Skip to content

Commit 596ad58

Browse files
committed
Factory method definition and applicability
1 parent 12775aa commit 596ad58

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ Use the Chain of Responsibility pattern when
6363

6464
* The set of objects that can handle a request should be specified dynamically.
6565

66+
#### 6.Factory Method
67+
Define an interface for creating an object, but let subclasses decide which to instantiate. Factory Method lets a class defer instantiation to subclasses.
68+
69+
##### Applicability:
70+
Use the Factory Method pattern when
71+
* A class can't anticipate the class of object it must create.
72+
* A class wants its subclasses to specify the objects it creates.
73+
* Classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclasses is the delegate.
74+
6675
--------
6776
Sources:
6877
- [Book:](https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612) Design Patterns

0 commit comments

Comments
 (0)