Skip to content

Commit 7a46174

Browse files
committed
Grammatical fixes to command pattern
1 parent bbdff14 commit 7a46174

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

command/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
layout: pattern
33
title: Command
44
folder: command
@@ -19,7 +19,7 @@ Encapsulate a request as an object, thereby letting you parameterize clients wit
1919
requests, queue or log requests, and support undoable operations.
2020

2121
## Explanation
22-
Real world example
22+
Real-world example
2323

2424
> There is a wizard casting spells on a goblin. The spells are executed on the goblin one by one.
2525
> The first spell shrinks the goblin and the second makes him invisible. Then the wizard reverses
@@ -135,7 +135,7 @@ public class Goblin extends Target {
135135
}
136136
```
137137

138-
Finally we have the wizard in main function who casts spell
138+
Finally, we have the wizard in the main function casting spells.
139139

140140
```java
141141
public static void main(String[] args) {
@@ -202,22 +202,22 @@ Use the Command pattern when you want to:
202202
* Parameterize objects by an action to perform. You can express such parameterization in a
203203
procedural language with a callback function, that is, a function that's registered somewhere to be
204204
called at a later point. Commands are an object-oriented replacement for callbacks.
205-
* Specify, queue, and execute requests at different times. A Command object can have a lifetime
205+
* Specify, queue, and execute requests at different times. A Command object can have a life
206206
independent of the original request. If the receiver of a request can be represented in an address
207207
space-independent way, then you can transfer a command object for the request to a different process
208208
and fulfill the request there.
209209
* Support undo. The Command's execute operation can store state for reversing its effects in the
210210
command itself. The Command interface must have an added un-execute operation that reverses the
211211
effects of a previous call to execute. The executed commands are stored in a history list.
212-
Unlimited-level undo and redo is achieved by traversing this list backwards and forwards calling
213-
un-execute and execute, respectively.
212+
Unlimited-level undo and redo functionality is achieved by traversing this list backward and forward
213+
calling un-execute and execute, respectively.
214214
* Support logging changes so that they can be reapplied in case of a system crash. By augmenting the
215215
Command interface with load and store operations, you can keep a persistent log of changes.
216-
Recovering from a crash involves reloading logged commands from disk and re-executing them with
216+
Recovering from a crash involves reloading logged commands from the disk and re-executing them with
217217
the execute operation.
218218
* Structure a system around high-level operations build on primitive operations. Such a structure is
219-
common in information systems that support transactions. A transaction encapsulates a set of changes
220-
to data. The Command pattern offers a way to model transactions. Commands have a common interface,
219+
common in information systems that support transactions. A transaction encapsulates a set of data
220+
changes. The Command pattern offers a way to model transactions. Commands have a common interface,
221221
letting you invoke all transactions the same way. The pattern also makes it easy to extend the
222222
system with new transactions.
223223

@@ -227,7 +227,7 @@ system with new transactions.
227227
* Implement callback functionality
228228
* Implement the undo functionality
229229

230-
## Real world examples
230+
## Real-world examples
231231

232232
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
233233
* [org.junit.runners.model.Statement](https://github.com/junit-team/junit4/blob/master/src/main/java/org/junit/runners/model/Statement.java)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* The Command pattern is a behavioral design pattern in which an object is used to encapsulate all
2828
* information needed to perform an action or trigger an event at a later time. This information
29-
* includes the method name, the object that owns the method and values for the method parameters.
29+
* includes the method name, the object that owns the method, and values for the method parameters.
3030
*
3131
* <p>Four terms always associated with the command pattern are command, receiver, invoker and
3232
* client. A command object (spell) knows about the receiver (target) and invokes a method of the

0 commit comments

Comments
 (0)