Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit808df54

Browse files
committed
Grammar fixes for strategy
1 parentb014dc2 commit808df54

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

‎strategy/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ Policy
1616
##Intent
1717

1818
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets
19-
the algorithm vary independently from clients that use it.
19+
the algorithm vary independently fromtheclients that use it.
2020

2121
##Explanation
2222

23-
Realworld example
23+
Real-world example
2424

25-
>Slaying dragons is a dangerous job. With experience it becomes easier. Veteran
25+
>Slaying dragons is a dangerous job. With experience, it becomes easier. Veteran
2626
>dragonslayers have developed different fighting strategies against different types of dragons.
2727
2828
In plain words
2929

30-
>Strategy pattern allows choosing the bestsuited algorithm at runtime.
30+
>Strategy pattern allows choosing the best-suited algorithm at runtime.
3131
3232
Wikipedia says
3333

@@ -36,7 +36,7 @@ Wikipedia says
3636
3737
**Programmatic Example**
3838

39-
Let's first introduce the dragonslaying strategy interface and its implementations.
39+
Let's first introduce the dragon-slaying strategy interface and its implementations.
4040

4141
```java
4242
@FunctionalInterface
@@ -73,7 +73,7 @@ public class SpellStrategy implements DragonSlayingStrategy {
7373
}
7474
```
7575

76-
And here is the mighty dragonslayer, whois able to pick his fighting strategy based on the
76+
And here is the mighty dragonslayer, whocan pick his fighting strategy based on the
7777
opponent.
7878

7979
```java
@@ -95,7 +95,7 @@ public class DragonSlayer {
9595
}
9696
```
9797

98-
Finally here's the dragonslayer in action.
98+
Finally, here's the dragonslayer in action.
9999

100100
```java
101101
LOGGER.info("Green dragon spotted ahead!");
@@ -120,7 +120,7 @@ Program output:
120120
You cast the spell of disintegration and the dragon vaporizes in a pile of dust!
121121
```
122122

123-
What's more, thenew feature Lambda Expressions in Java 8 provides another approach for the implementation:
123+
What's more, thelambda expressions in Java 8 provides another approach for the implementation:
124124

125125
```java
126126
publicclassLambdaStrategy {
@@ -163,7 +163,7 @@ And here's the dragonslayer in action.
163163
dragonSlayer.goToBattle();
164164
```
165165

166-
Programoutput is the same as above one.
166+
The programoutput is the same as the above one.
167167

168168
##Class diagram
169169

@@ -175,8 +175,8 @@ Use the Strategy pattern when
175175

176176
* Many related classes differ only in their behavior. Strategies provide a way to configure a class either one of many behaviors
177177
* You need different variants of an algorithm. for example, you might define algorithms reflecting different space/time trade-offs. Strategies can be used when these variants are implemented as a class hierarchy of algorithms
178-
* An algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex, algorithm-specific data structures
179-
* A class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, move related conditional branches into their own Strategy class
178+
* An algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex algorithm-specific data structures
179+
* A class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, movetherelated conditional branches into their own Strategy class
180180

181181
##Tutorial
182182

‎strategy/src/main/java/com/iluwatar/strategy/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* enables an algorithm's behavior to be selected at runtime.</p>
3232
*
3333
* <p>Before Java 8 the Strategies needed to be separate classes forcing the developer
34-
* to write lots of boilerplate code. With modern Java it is easy to pass behavior
34+
* to write lots of boilerplate code. With modern Java, it is easy to pass behavior
3535
* with method references and lambdas making the code shorter and more readable.</p>
3636
*
3737
* <p>In this example ({@link DragonSlayingStrategy}) encapsulates an algorithm. The containing

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp