mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-03 22:13:22 +00:00
Added real world example of Builder.
This commit is contained in:
1 parent
d6e6c32980
commit
f22d4a3610
1 file changed
+3
@@ -61,6 +61,9 @@
|
||||
* the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled
|
||||
* the construction process must allow different representations for the object that's constructed
|
||||
|
||||
**Real world examples:**
|
||||
* [java.lang.StringBuilder](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html)
|
||||
|
||||
## <a name="factory-method">Factory Method</a> [↑](#list-of-design-patterns)
|
||||
**Intent:** Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
|
||||
|
||||
|
||||
Reference in new issue
Block a user