Skip to content

Commit 5f1a62f

Browse files
committed
Merge commit 'refs/pull/46/head' of https://github.com/Froussios/Intro-To-RxJava
Fix typo in Part 3.1
2 parents 164f199 + f9e5f7c commit 5f1a62f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Subscription over
236236
Rx is designed in the style of functional programming, but it exists within an object-oriented environment. We also have to protect against object-oriented dangers. Consider this naive implementation for a service that returns an observable.
237237

238238
```java
239-
public class BrakeableService {
239+
public class BreakableService {
240240
public BehaviorSubject<String> items = BehaviorSubject.create("Greet");
241241
public void play() {
242242
items.onNext("Hello");
@@ -249,7 +249,7 @@ public class BrakeableService {
249249
The code above does not prevent a naughty consumer from changing your `items` with one of their own. After that happens, subscriptions done before the change will no longer receive items, because you are not calling `onNext` on the right `Subject` any more. We obviously need to hide access to our `Subject`
250250

251251
```java
252-
public class BrakeableService {
252+
public class BreakableService {
253253
private final BehaviorSubject<String> items = BehaviorSubject.create("Greet");
254254

255255
public BehaviorSubject<String> getValues() {
@@ -320,7 +320,7 @@ data.subscribe(d -> System.out.println(d.id + ": " + d.name));
320320
2: Garbage
321321
```
322322

323-
The first subscriber is the first to be called for each item. Its action is to modify the data. Once the first subscriber is done, the same reference is also passed to the second subscriber, only now the data is changed in a way that was not declared in the producer. A developer needs to have a deep understanding of Rx, Java and their environment in order to reason about the sequence of modifications, and then argue that such code would run according to a plan. It is simpler to avoid mutable state altogether. Observables should be seen as a sequence notifications about resolved events.
323+
The first subscriber is the first to be called for each item. Its action is to modify the data. Once the first subscriber is done, the same reference is also passed to the second subscriber, only now the data is changed in a way that was not declared in the producer. A developer needs to have a deep understanding of Rx, Java and their environment in order to reason about the sequence of modifications, and then argue that such code would run according to a plan. It is simpler to avoid mutable state altogether. Observables should be seen as a sequence of notifications about resolved events.
324324

325325

326326

0 commit comments

Comments
 (0)