Skip to content

Commit e2ce0f6

Browse files
committed
Update 1. Side effects.md
1 parent 183954b commit e2ce0f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Part 3 - Taming the sequence/1. Side effects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ So far we've learned how to create observables and how to extract relevant data
44

55
# Side effects
66

7-
Functions without side-effects interact with the rest of the program exclusively through their arguments and return values. When the operations within a function can affect the outcome of another function (or a subsequent call to the same function), we say that the function has side effects. Common side effects are writes to storage, logging, debugging or prints to a user interface. A more language-dependent form of side effect is the ability to modify the state of an object that is visibible to other functions, which is something that Java considers legal. A function passed as an argument to an Rx operator can modify values in a wider scope, perform IO operations or update a display.
7+
Functions without side-effects interact with the rest of the program exclusively through their arguments and return values. When the operations within a function can affect the outcome of another function (or a subsequent call to the same function), we say that the function has side effects. Common side effects are writes to storage, logging, debugging or prints to a user interface. A more language-dependent form of side effect is the ability to modify the state of an object that is visible to other functions, which is something that Java considers legal. A function passed as an argument to an Rx operator can modify values in a wider scope, perform IO operations or update a display.
88

99
Side effects can be very useful and are unavoidable in many cases. But they also have pitfalls. Rx developers are encouraged to avoid unnecessary side effects, and to have a clear intention when they do use them. While some cases are justified, abuse introduces unnecessary hazards.
1010

@@ -114,7 +114,7 @@ indexed.subscribe(w -> System.out.println("2nd observer: " + w.index + ": " + w.
114114
2nd observer: 4: please
115115
```
116116

117-
The result now is valid. We removed the shared state between the two subscriptions and now they can't affect eachother.
117+
The result now is valid. We removed the shared state between the two subscriptions and now they can't affect each other.
118118

119119
## do
120120

0 commit comments

Comments
 (0)