Skip to content

Commit 700f5c6

Browse files
corrected some typo
1 parent f4fa73c commit 700f5c6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

private-class-data/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ attributes by encapsulating them in single Data object.
1717

1818
Real world example
1919

20-
> Imagine you are cooking a stew for your family for dinner. You want to prevent your family members from comsuming the stew by tasting it while you are cooking, otherwise there will be no more stew for dinner later.
20+
> Imagine you are cooking a stew for your family for dinner. You want to prevent your family members from consuming the stew by tasting it while you are cooking, otherwise there will be no more stew for dinner later.
2121
2222
In plain words
2323

24-
> Private class data pattern prevent manipulation of data that is meant to be immutable by seperating the data from methods that use it into a class that maintains the data state.
24+
> Private class data pattern prevent manipulation of data that is meant to be immutable by separating the data from methods that use it into a class that maintains the data state.
2525
2626
Wikipedia says
2727

2828
> Private class data is a design pattern in computer programming used to encapsulate class attributes and their manipulation.
2929
3030
**Programmatic Example**
3131

32-
Taking our stew example from above. First we have a Stew class where its data is not protected by private class data, making the stew's ingredient mutable to class methods.
32+
Taking our stew example from above. First we have a `Stew` class where its data is not protected by private class data, making the stew's ingredient mutable to class methods.
3333

3434
```
3535
public class Stew {
@@ -66,7 +66,7 @@ public class Stew {
6666
}
6767
```
6868

69-
Now, we have ImmutableStew class, where its data is protected by StewData class. Now, the methods in are unable to manipulate the data of the ImmutableStew class.
69+
Now, we have `ImmutableStew` class, where its data is protected by `StewData` class. Now, the methods in are unable to manipulate the data of the `ImmutableStew` class.
7070
```
7171
public class StewData {
7272
private final int numPotatoes;

0 commit comments

Comments
 (0)