Fixes to builder pattern grammar
This commit is contained in:
parent
e361223def
commit
0f9f3b90c2
@ -16,11 +16,11 @@ process can create different representations.
|
|||||||
|
|
||||||
## Explanation
|
## Explanation
|
||||||
|
|
||||||
Real world example
|
Real-world example
|
||||||
|
|
||||||
> Imagine a character generator for a role-playing game. The easiest option is to let the computer
|
> Imagine a character generator for a role-playing game. The easiest option is to let the computer
|
||||||
> create the character for you. If you want to manually select the character details like
|
> create the character for you. If you want to manually select the character details like
|
||||||
> profession, gender, hair color etc. the character generation becomes a step-by-step process that
|
> profession, gender, hair color, etc. the character generation becomes a step-by-step process that
|
||||||
> completes when all the selections are ready.
|
> completes when all the selections are ready.
|
||||||
|
|
||||||
In plain words
|
In plain words
|
||||||
@ -49,7 +49,7 @@ anti-pattern.
|
|||||||
|
|
||||||
**Programmatic Example**
|
**Programmatic Example**
|
||||||
|
|
||||||
The sane alternative is to use the Builder pattern. First of all we have our hero that we want to
|
The sane alternative is to use the Builder pattern. First of all, we have our hero that we want to
|
||||||
create:
|
create:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@ -134,7 +134,7 @@ Use the Builder pattern when
|
|||||||
* The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled
|
* 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
|
* The construction process must allow different representations for the object that's constructed
|
||||||
|
|
||||||
## Real world examples
|
## Real-world examples
|
||||||
|
|
||||||
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
|
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
|
||||||
* [java.nio.ByteBuffer](http://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html#put-byte-) as well as similar buffers such as FloatBuffer, IntBuffer and so on.
|
* [java.nio.ByteBuffer](http://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html#put-byte-) as well as similar buffers such as FloatBuffer, IntBuffer and so on.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user