Skip to content

Commit 9a08e35

Browse files
committed
Improve Builder Javadoc
1 parent cdd586e commit 9a08e35

File tree

1 file changed

+14
-1
lines changed
  • builder/src/main/java/com/iluwatar/builder

1 file changed

+14
-1
lines changed

builder/src/main/java/com/iluwatar/builder/App.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@
44

55
/**
66
*
7-
* This is the Builder pattern variation as described by Joshua Bloch in
7+
* The intention of the Builder pattern is to find a solution to the telescoping
8+
* constructor anti-pattern. The telescoping constructor anti-pattern occurs when the
9+
* increase of object constructor parameter combination leads to an exponential list
10+
* of constructors. Instead of using numerous constructors, the builder pattern uses
11+
* another object, a builder, that receives each initialization parameter step by step
12+
* and then returns the resulting constructed object at once.
13+
* <p>
14+
* The Builder pattern has another benefit. It can be used for objects that contain
15+
* flat data (html code, SQL query, X.509 certificate...), that is to say, data that
16+
* can't be easily edited. This type of data cannot be edited step by step and must
17+
* be edited at once. The best way to construct such an object is to use a builder
18+
* class.
19+
* <p>
20+
* In this example we have the Builder pattern variation as described by Joshua Bloch in
821
* Effective Java 2nd Edition.
922
* <p>
1023
* We want to build {@link Hero} objects, but its construction is complex because of the

0 commit comments

Comments
 (0)