From 808df54dc0264a130fe6a0ac8f068aa47c053858 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?=
Date: Tue, 22 Jun 2021 20:24:25 +0300
Subject: [PATCH] Grammar fixes for strategy
---
strategy/README.md | 22 +++++++++----------
.../main/java/com/iluwatar/strategy/App.java | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/strategy/README.md b/strategy/README.md
index eb7bbbd01..83774fba8 100644
--- a/strategy/README.md
+++ b/strategy/README.md
@@ -16,18 +16,18 @@ Policy
## Intent
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets
-the algorithm vary independently from clients that use it.
+the algorithm vary independently from the clients that use it.
## Explanation
-Real world example
+Real-world example
-> Slaying dragons is a dangerous job. With experience it becomes easier. Veteran
+> Slaying dragons is a dangerous job. With experience, it becomes easier. Veteran
> dragonslayers have developed different fighting strategies against different types of dragons.
In plain words
-> Strategy pattern allows choosing the best suited algorithm at runtime.
+> Strategy pattern allows choosing the best-suited algorithm at runtime.
Wikipedia says
@@ -36,7 +36,7 @@ Wikipedia says
**Programmatic Example**
-Let's first introduce the dragon slaying strategy interface and its implementations.
+Let's first introduce the dragon-slaying strategy interface and its implementations.
```java
@FunctionalInterface
@@ -73,7 +73,7 @@ public class SpellStrategy implements DragonSlayingStrategy {
}
```
-And here is the mighty dragonslayer, who is able to pick his fighting strategy based on the
+And here is the mighty dragonslayer, who can pick his fighting strategy based on the
opponent.
```java
@@ -95,7 +95,7 @@ public class DragonSlayer {
}
```
-Finally here's the dragonslayer in action.
+Finally, here's the dragonslayer in action.
```java
LOGGER.info("Green dragon spotted ahead!");
@@ -120,7 +120,7 @@ Program output:
You cast the spell of disintegration and the dragon vaporizes in a pile of dust!
```
-What's more, the new feature Lambda Expressions in Java 8 provides another approach for the implementation:
+What's more, the lambda expressions in Java 8 provides another approach for the implementation:
```java
public class LambdaStrategy {
@@ -163,7 +163,7 @@ And here's the dragonslayer in action.
dragonSlayer.goToBattle();
```
-Program output is the same as above one.
+The program output is the same as the above one.
## Class diagram
@@ -175,8 +175,8 @@ Use the Strategy pattern when
* Many related classes differ only in their behavior. Strategies provide a way to configure a class either one of many behaviors
* 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
-* An algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex, algorithm-specific data structures
-* 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
+* An algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex algorithm-specific data structures
+* A class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, move the related conditional branches into their own Strategy class
## Tutorial
diff --git a/strategy/src/main/java/com/iluwatar/strategy/App.java b/strategy/src/main/java/com/iluwatar/strategy/App.java
index 8554ce3ff..383712c39 100644
--- a/strategy/src/main/java/com/iluwatar/strategy/App.java
+++ b/strategy/src/main/java/com/iluwatar/strategy/App.java
@@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j;
* enables an algorithm's behavior to be selected at runtime.
*
* Before Java 8 the Strategies needed to be separate classes forcing the developer
- * to write lots of boilerplate code. With modern Java it is easy to pass behavior
+ * to write lots of boilerplate code. With modern Java, it is easy to pass behavior
* with method references and lambdas making the code shorter and more readable.
*
* In this example ({@link DragonSlayingStrategy}) encapsulates an algorithm. The containing