SlideShare a Scribd company logo
1 of 35
11
REACTIVE PROGRAMMING NO ANDROID
Guilherme Branco
Software Engineer
Guilherme Pereira Branco
@guipbranco
22
REACTIVE PROGRAMMING NO ANDROID
Guilherme Branco
Software Engineer
Guilherme Pereira Branco
@guipbranco
Reactive Programming
é do balacobaco!
Quem não usa está
por fora, meu!
Sou deveras
experiente em RxJava!
55
RxJava RxAndroid
66
Reactive Programming | O Que é?
• Pull x Push: Ao invés de pedir algo e esperar, o desenvolvedor
simplesmente pede por algo e é notificado quando o resultado estiver
disponível.
• Paradigma baseado no conceito de fluxo de dados assíncrono.
• Mais flexível. O Desenvolvedor ignora se os dados chegam de forma
síncrona ou assíncrona. O código simplesmente funciona.
• Fontes de dados podem ser combinadas e não aninhadas, afastando o
desenvolvedor do “callback hell”
77
Observable Observer
Emite
item1
item2
item3
Manipula item 1
Manipula item 2
Manipula item 3
onNext(item1)
onNext(item2)
onNext(item3)
Itens acabaram onCompleted() completar
Ops! Erro… onError(error) Trata erro
Reactive Programming | Fluxo
99
Anatomia | Principal Construção
Observable.from(lectureService.getLectures()) 1. Observable
.subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) 3. Schedulers
.subscribe(getObserver()) 2. Observer
1010
public interface LectureService {
List<Lecture> getLectures();
}
Anatomia | Principal Construção
Observable.from(lectureService.getLectures()) 1. Observable
1111
Anatomia | Principal Construção
Observable.from(lectureService.getLectures()) 1. Observable
.subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) 3. Schedulers
.subscribe(getObserver()) 2. Observer
1212
Anatomia | Observer / Subscriber
private Observer<Lecture> getObserver(){
return new Observer<Lecture>() {
@Override
public void onCompleted() {
Log.e(TAG, "onCompleted");
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
public void onNext(Lecture lecture){
Log.e(TAG, "onNext");
}
});
.subscribe(getObserver()) 2. Observer
1313
Anatomia | Principal Construção
Observable.from(lectureService.getLectures()) 1. Observable
.subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) 3. Schedulers
.subscribe(getObserver()) 2. Observer
ObserverObservable
=
4. Subscription
1414
Anatomia | Principal Construção
.subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(getObserver())
Observable<Lecture> observable = Observable.from(lectureService.getLectures()) ;
observableSubscription subscription =
1. subscription.unsubscribe()
2. CompositeSubscription compSubscription;
compSubscription.add(subscription);
3. compSubscription.unsubscribe()
1515
Exemplo | TDC
1616
public interface LectureService {
List<Lecture> getLectures();
}
Exemplo | AsyncTask
1717
new LectureAsyncTask().execute();
private class LectureAsyncTask
extends AsyncTask<String, Void, List<Lecture>>{
@Override
protected void onPreExecute() {
showLoading();
}
@Override
protected List<Lecture> doInBackground(String... params){
return lectureService.getLectures();
}
@Override
protected void onPostExecute(List<Lecture> lectures){
hideLoading();
renderItems(lectures);
}
}
Anatomia | AsyncTask -> Reactive
1818
new LectureAsyncTask().execute();
private class LectureAsyncTask
extends AsyncTask<String, Void, List<Lecture>>{
@Override
protected void onPreExecute() {
showLoading();
}
@Override
protected List<Lecture> doInBackground(String... params){
return lectureService.getLectures();
}
@Override
protected void onPostExecute(List<Lecture> lectures){
hideLoading();
renderItems(lectures);
}
}
Anatomia | AsyncTask -> Reactive
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
1919
Anatomia | AsyncTask -> Reactive
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
2020
new LectureAsyncTask().execute();
private class LectureAsyncTask
extends AsyncTask<String, Void, List<Lecture>>{
@Override
protected void onPreExecute() {
showLoading();
}
@Override
protected List<Lecture> doInBackground(String... params){
return lectureService.getLectures();
}
@Override
protected void onPostExecute(List<Lecture> lectures){
hideLoading();
renderItems(lectures);
}
}
Anatomia | AsyncTask -> Reactive
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.subscribe(
new Subscriber<List<Lecture>>() {
@Override
public void onCompleted() {
hideLoading();
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
public void onNext(List<Lecture> lectures){
renderItems(lectures);
}
});
.toList()
2121
Anatomia | AsyncTask -> Reactive
.subscribe(
new Subscriber<List<Lecture>>() {
@Override
public void onCompleted() {
hideLoading();
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
public void onNext(List<Lecture> lectures){
renderItems(lectures);
}
});
2222
new LectureAsyncTask().execute();
private class LectureAsyncTask
extends AsyncTask<String, Void, List<Lecture>>{
@Override
protected void onPreExecute() {
showLoading();
}
@Override
protected List<Lecture> doInBackground(String... params){
return lectureService.getLectures();
}
@Override
protected void onPostExecute(List<Lecture> lectures){
hideLoading();
renderItems(lectures);
}
}
Anatomia | AsyncTask -> Reactive
.subscribe(
new Subscriber<List<Lecture>>() {
@Override
public void onCompleted() {
hideLoading();
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
public void onNext(List<Lecture> lectures){
renderItems(lectures);
}
});
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
2323
Exemplo | AsyncTask -> Reactive
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
2424
new LectureAsyncTask().execute();
private class LectureAsyncTask
extends AsyncTask<String, Void, List<Lecture>>{
@Override
protected void onPreExecute() {
showLoading();
}
@Override
protected List<Lecture> doInBackground(String... params){
return lectureService.getLectures();
}
@Override
protected void onPostExecute(List<Lecture> lectures){
hideLoading();
renderItems(lectures);
}
}
Exemplo | AsyncTask -> Reactive
.subscribe(
new Subscriber<List<Lecture>>() {
@Override
public void onCompleted() {
hideLoading();
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
public void onNext(List<Lecture> lectures){
renderItems(lectures);
}
});
.toList()
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
2525
Exemplo | AsyncTask -> Reactive
.subscribe(
new Subscriber<List<Lecture>>() {
@Override
public void onCompleted() {
hideLoading();
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "onError: " + e.getMessage());
}
@Override
public void onNext(List<Lecture> lectures){
renderItems(lectures);
}
});
.observeOn(AndroidSchedulers.mainThread())
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
2626
Exemplo | RxJava
.subscribe(new Subscriber(){…});
.observeOn(AndroidSchedulers.mainThread())
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
2727
Exemplo | TDC
2828
.subscribe(new Subscriber(){…});
.observeOn(AndroidSchedulers.mainThread())
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
Exemplo | RxJava
2929
Operator | Filter
.filter(new Func1<Lecture, Boolean>() {
@Override
public Boolean call(Lecture lecture) {
return lecture.getDay().equalsIgnoreCase(day);
}
})
.subscribe(new Subscriber(){…});
.observeOn(AndroidSchedulers.mainThread())
Observable.from(lectureService.getLectures())
.doOnSubscribe(showLoading())
.subscribeOn(Schedulers.io())
.toList()
3030
Exemplo | TDC
3131
Exemplo | TDC
3232
Observable<Lecture> observable = getLectures();
.map(new Func1<Lecture, String>() {
@Override
public String call(Lecture lecture) {
return lecture.getDay();
}
}) // Observable<String>
.cast(CharSequence.class) // Observable<CharSequence>
Operator | Map, Cast, Distinct…
.distinct() // Mesmo Observable sem dados repetidos
.toList() // Observable<List<CharSequence>>
.subscribe(new Subscriber(){…});
observable
3333
Reactive Programming | Links
https://github.com/ReactiveX/RxJava
https://www.packtpub.com/application-development/rxjava-essentials
http://rxmarbles.com
34
http://github.com/gpbranco/rx-example-tdc
OBRIGADO.
Big Brains Wanted
Join our team! Go to arctouch.com/brjobs
Visit our booth to win an Apple Watch.

More Related Content

What's hot

Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance PuzzlersDoug Hawkins
 
An Introduction to RxJava
An Introduction to RxJavaAn Introduction to RxJava
An Introduction to RxJavaSanjay Acharya
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginnersishan0019
 
The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202Mahmoud Samir Fayed
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 
OSMC 2012 | Neues in Nagios 4.0 by Andreas Ericsson
OSMC 2012 | Neues in Nagios 4.0 by Andreas EricssonOSMC 2012 | Neues in Nagios 4.0 by Andreas Ericsson
OSMC 2012 | Neues in Nagios 4.0 by Andreas EricssonNETWAYS
 
The Ring programming language version 1.5.4 book - Part 79 of 185
The Ring programming language version 1.5.4 book - Part 79 of 185The Ring programming language version 1.5.4 book - Part 79 of 185
The Ring programming language version 1.5.4 book - Part 79 of 185Mahmoud Samir Fayed
 
Unit testing CourseSites Apache Filter
Unit testing CourseSites Apache FilterUnit testing CourseSites Apache Filter
Unit testing CourseSites Apache FilterWayan Wira
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in JavaDoug Hawkins
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone DevelopmentGiordano Scalzo
 
Taking advantage of Prometheus relabeling
Taking advantage of Prometheus relabelingTaking advantage of Prometheus relabeling
Taking advantage of Prometheus relabelingJulien Pivotto
 
XpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp wayXpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp wayGiordano Scalzo
 
Spock Testing Framework - The Next Generation
Spock Testing Framework - The Next GenerationSpock Testing Framework - The Next Generation
Spock Testing Framework - The Next GenerationBTI360
 

What's hot (19)

Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance Puzzlers
 
Saving lives with rx java
Saving lives with rx javaSaving lives with rx java
Saving lives with rx java
 
An Introduction to RxJava
An Introduction to RxJavaAn Introduction to RxJava
An Introduction to RxJava
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202
 
JVM Mechanics
JVM MechanicsJVM Mechanics
JVM Mechanics
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
OSMC 2012 | Neues in Nagios 4.0 by Andreas Ericsson
OSMC 2012 | Neues in Nagios 4.0 by Andreas EricssonOSMC 2012 | Neues in Nagios 4.0 by Andreas Ericsson
OSMC 2012 | Neues in Nagios 4.0 by Andreas Ericsson
 
The Ring programming language version 1.5.4 book - Part 79 of 185
The Ring programming language version 1.5.4 book - Part 79 of 185The Ring programming language version 1.5.4 book - Part 79 of 185
The Ring programming language version 1.5.4 book - Part 79 of 185
 
Unit testing CourseSites Apache Filter
Unit testing CourseSites Apache FilterUnit testing CourseSites Apache Filter
Unit testing CourseSites Apache Filter
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Mutation @ Spotify
Mutation @ Spotify Mutation @ Spotify
Mutation @ Spotify
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
 
Rxjs vienna
Rxjs viennaRxjs vienna
Rxjs vienna
 
Taking advantage of Prometheus relabeling
Taking advantage of Prometheus relabelingTaking advantage of Prometheus relabeling
Taking advantage of Prometheus relabeling
 
XpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp wayXpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp way
 
Spock Testing Framework - The Next Generation
Spock Testing Framework - The Next GenerationSpock Testing Framework - The Next Generation
Spock Testing Framework - The Next Generation
 
java assignment
java assignmentjava assignment
java assignment
 

Viewers also liked

Usando POP com Programação Funcional
Usando POP com Programação FuncionalUsando POP com Programação Funcional
Usando POP com Programação FuncionalTales Andrade
 
Criando app Android utilizando Kotlin
Criando app Android utilizando KotlinCriando app Android utilizando Kotlin
Criando app Android utilizando KotlinLuiz Henrique Santana
 
Node.js, is it the solution for every problem?
Node.js, is it the solution for every problem?Node.js, is it the solution for every problem?
Node.js, is it the solution for every problem?Jéferson Machado
 
TDC Floripa - Trilha iOS - Mercado iOS no Brasil.
TDC Floripa - Trilha iOS - Mercado iOS no Brasil.TDC Floripa - Trilha iOS - Mercado iOS no Brasil.
TDC Floripa - Trilha iOS - Mercado iOS no Brasil.Douglas Fischer
 
Dev e designer em projetos de UX, vai ter briga?!
Dev e designer em projetos de UX, vai ter briga?!Dev e designer em projetos de UX, vai ter briga?!
Dev e designer em projetos de UX, vai ter briga?!Diego Motta
 
TDC Floripa - Trilha iOS - Debate sobre o futuro da plataforma
TDC Floripa - Trilha iOS - Debate sobre o futuro da plataformaTDC Floripa - Trilha iOS - Debate sobre o futuro da plataforma
TDC Floripa - Trilha iOS - Debate sobre o futuro da plataformaDouglas Fischer
 
Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.
Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.
Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.Txai Wieser
 
Sucesso e derrota na Arquitetura Agile
Sucesso e derrota na Arquitetura AgileSucesso e derrota na Arquitetura Agile
Sucesso e derrota na Arquitetura AgileSérgio Giraldo
 
TDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e FacilitaçõesTDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e Facilitaçõestdc-globalcode
 
TDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.JsTDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.Jstdc-globalcode
 
TDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLTDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLtdc-globalcode
 
TDC2016SP - Trilha Mobile
TDC2016SP - Trilha MobileTDC2016SP - Trilha Mobile
TDC2016SP - Trilha Mobiletdc-globalcode
 
TDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLTDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLtdc-globalcode
 
TDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.JsTDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.Jstdc-globalcode
 
TDC2016SP - Trilha DevOps Java
TDC2016SP - Trilha DevOps JavaTDC2016SP - Trilha DevOps Java
TDC2016SP - Trilha DevOps Javatdc-globalcode
 

Viewers also liked (20)

Interaccion Web
Interaccion WebInteraccion Web
Interaccion Web
 
Usando POP com Programação Funcional
Usando POP com Programação FuncionalUsando POP com Programação Funcional
Usando POP com Programação Funcional
 
A Gradle Story
A Gradle StoryA Gradle Story
A Gradle Story
 
Devs dando pitacos
Devs dando pitacosDevs dando pitacos
Devs dando pitacos
 
Criando app Android utilizando Kotlin
Criando app Android utilizando KotlinCriando app Android utilizando Kotlin
Criando app Android utilizando Kotlin
 
Node.js, is it the solution for every problem?
Node.js, is it the solution for every problem?Node.js, is it the solution for every problem?
Node.js, is it the solution for every problem?
 
Android NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo NativoAndroid NDK: Entrando no Mundo Nativo
Android NDK: Entrando no Mundo Nativo
 
TDC Floripa - Trilha iOS - Mercado iOS no Brasil.
TDC Floripa - Trilha iOS - Mercado iOS no Brasil.TDC Floripa - Trilha iOS - Mercado iOS no Brasil.
TDC Floripa - Trilha iOS - Mercado iOS no Brasil.
 
Dev e designer em projetos de UX, vai ter briga?!
Dev e designer em projetos de UX, vai ter briga?!Dev e designer em projetos de UX, vai ter briga?!
Dev e designer em projetos de UX, vai ter briga?!
 
TDC Floripa - Trilha iOS - Debate sobre o futuro da plataforma
TDC Floripa - Trilha iOS - Debate sobre o futuro da plataformaTDC Floripa - Trilha iOS - Debate sobre o futuro da plataforma
TDC Floripa - Trilha iOS - Debate sobre o futuro da plataforma
 
Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.
Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.
Gerenciamento de Memória em Swift - The Weak, the Strong, and the Unowned.
 
Sucesso e derrota na Arquitetura Agile
Sucesso e derrota na Arquitetura AgileSucesso e derrota na Arquitetura Agile
Sucesso e derrota na Arquitetura Agile
 
TDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e FacilitaçõesTDC2016SP - Dinâmica e Facilitações
TDC2016SP - Dinâmica e Facilitações
 
TDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.JsTDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.Js
 
Expression Language 3.0
Expression Language 3.0Expression Language 3.0
Expression Language 3.0
 
TDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLTDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQL
 
TDC2016SP - Trilha Mobile
TDC2016SP - Trilha MobileTDC2016SP - Trilha Mobile
TDC2016SP - Trilha Mobile
 
TDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLTDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQL
 
TDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.JsTDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.Js
 
TDC2016SP - Trilha DevOps Java
TDC2016SP - Trilha DevOps JavaTDC2016SP - Trilha DevOps Java
TDC2016SP - Trilha DevOps Java
 

Similar to Reactive Programming no Android

Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaRick Warren
 
Understanding reactive programming with microsoft reactive extensions
Understanding reactive programming  with microsoft reactive extensionsUnderstanding reactive programming  with microsoft reactive extensions
Understanding reactive programming with microsoft reactive extensionsOleksandr Zhevzhyk
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 SlidesYarikS
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidEgor Andreevich
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...PROIDEA
 
Reactive programming and RxJS
Reactive programming and RxJSReactive programming and RxJS
Reactive programming and RxJSRavi Mone
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 
Testing time and concurrency Rx
Testing time and concurrency RxTesting time and concurrency Rx
Testing time and concurrency RxTamir Dresher
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaNexThoughts Technologies
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaKros Huang
 
Rx for Android & iOS by Harin Trivedi
Rx for Android & iOS  by Harin TrivediRx for Android & iOS  by Harin Trivedi
Rx for Android & iOS by Harin Trivediharintrivedi
 
RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015Constantine Mars
 
GDG DevFest 2015 - Reactive approach for slowpokes
GDG DevFest 2015 - Reactive approach for slowpokesGDG DevFest 2015 - Reactive approach for slowpokes
GDG DevFest 2015 - Reactive approach for slowpokesSergey Tarasevich
 

Similar to Reactive Programming no Android (20)

Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
Understanding reactive programming with microsoft reactive extensions
Understanding reactive programming  with microsoft reactive extensionsUnderstanding reactive programming  with microsoft reactive extensions
Understanding reactive programming with microsoft reactive extensions
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
RxAndroid
RxAndroidRxAndroid
RxAndroid
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 Slides
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich Android
 
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
Reactive programming and RxJS
Reactive programming and RxJSReactive programming and RxJS
Reactive programming and RxJS
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Testing time and concurrency Rx
Testing time and concurrency RxTesting time and concurrency Rx
Testing time and concurrency Rx
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJava
 
Rx for Android & iOS by Harin Trivedi
Rx for Android & iOS  by Harin TrivediRx for Android & iOS  by Harin Trivedi
Rx for Android & iOS by Harin Trivedi
 
RxJava@Android
RxJava@AndroidRxJava@Android
RxJava@Android
 
RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015RxJava for Android - GDG DevFest Ukraine 2015
RxJava for Android - GDG DevFest Ukraine 2015
 
Rx java in action
Rx java in actionRx java in action
Rx java in action
 
GDG DevFest 2015 - Reactive approach for slowpokes
GDG DevFest 2015 - Reactive approach for slowpokesGDG DevFest 2015 - Reactive approach for slowpokes
GDG DevFest 2015 - Reactive approach for slowpokes
 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
 
Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)
 
Rx java workshop
Rx java workshop Rx java workshop
Rx java workshop
 

Recently uploaded

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Reactive Programming no Android

  • 1. 11 REACTIVE PROGRAMMING NO ANDROID Guilherme Branco Software Engineer Guilherme Pereira Branco @guipbranco
  • 2. 22 REACTIVE PROGRAMMING NO ANDROID Guilherme Branco Software Engineer Guilherme Pereira Branco @guipbranco
  • 3. Reactive Programming é do balacobaco! Quem não usa está por fora, meu! Sou deveras experiente em RxJava!
  • 4.
  • 6. 66 Reactive Programming | O Que é? • Pull x Push: Ao invés de pedir algo e esperar, o desenvolvedor simplesmente pede por algo e é notificado quando o resultado estiver disponível. • Paradigma baseado no conceito de fluxo de dados assíncrono. • Mais flexível. O Desenvolvedor ignora se os dados chegam de forma síncrona ou assíncrona. O código simplesmente funciona. • Fontes de dados podem ser combinadas e não aninhadas, afastando o desenvolvedor do “callback hell”
  • 7. 77 Observable Observer Emite item1 item2 item3 Manipula item 1 Manipula item 2 Manipula item 3 onNext(item1) onNext(item2) onNext(item3) Itens acabaram onCompleted() completar Ops! Erro… onError(error) Trata erro Reactive Programming | Fluxo
  • 8.
  • 9. 99 Anatomia | Principal Construção Observable.from(lectureService.getLectures()) 1. Observable .subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) 3. Schedulers .subscribe(getObserver()) 2. Observer
  • 10. 1010 public interface LectureService { List<Lecture> getLectures(); } Anatomia | Principal Construção Observable.from(lectureService.getLectures()) 1. Observable
  • 11. 1111 Anatomia | Principal Construção Observable.from(lectureService.getLectures()) 1. Observable .subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) 3. Schedulers .subscribe(getObserver()) 2. Observer
  • 12. 1212 Anatomia | Observer / Subscriber private Observer<Lecture> getObserver(){ return new Observer<Lecture>() { @Override public void onCompleted() { Log.e(TAG, "onCompleted"); } @Override public void onError(Throwable e) { Log.e(TAG, "onError: " + e.getMessage()); } @Override public void onNext(Lecture lecture){ Log.e(TAG, "onNext"); } }); .subscribe(getObserver()) 2. Observer
  • 13. 1313 Anatomia | Principal Construção Observable.from(lectureService.getLectures()) 1. Observable .subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) 3. Schedulers .subscribe(getObserver()) 2. Observer ObserverObservable = 4. Subscription
  • 14. 1414 Anatomia | Principal Construção .subcribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribe(getObserver()) Observable<Lecture> observable = Observable.from(lectureService.getLectures()) ; observableSubscription subscription = 1. subscription.unsubscribe() 2. CompositeSubscription compSubscription; compSubscription.add(subscription); 3. compSubscription.unsubscribe()
  • 16. 1616 public interface LectureService { List<Lecture> getLectures(); } Exemplo | AsyncTask
  • 17. 1717 new LectureAsyncTask().execute(); private class LectureAsyncTask extends AsyncTask<String, Void, List<Lecture>>{ @Override protected void onPreExecute() { showLoading(); } @Override protected List<Lecture> doInBackground(String... params){ return lectureService.getLectures(); } @Override protected void onPostExecute(List<Lecture> lectures){ hideLoading(); renderItems(lectures); } } Anatomia | AsyncTask -> Reactive
  • 18. 1818 new LectureAsyncTask().execute(); private class LectureAsyncTask extends AsyncTask<String, Void, List<Lecture>>{ @Override protected void onPreExecute() { showLoading(); } @Override protected List<Lecture> doInBackground(String... params){ return lectureService.getLectures(); } @Override protected void onPostExecute(List<Lecture> lectures){ hideLoading(); renderItems(lectures); } } Anatomia | AsyncTask -> Reactive Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .toList()
  • 19. 1919 Anatomia | AsyncTask -> Reactive Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .toList()
  • 20. 2020 new LectureAsyncTask().execute(); private class LectureAsyncTask extends AsyncTask<String, Void, List<Lecture>>{ @Override protected void onPreExecute() { showLoading(); } @Override protected List<Lecture> doInBackground(String... params){ return lectureService.getLectures(); } @Override protected void onPostExecute(List<Lecture> lectures){ hideLoading(); renderItems(lectures); } } Anatomia | AsyncTask -> Reactive Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .subscribe( new Subscriber<List<Lecture>>() { @Override public void onCompleted() { hideLoading(); } @Override public void onError(Throwable e) { Log.e(TAG, "onError: " + e.getMessage()); } @Override public void onNext(List<Lecture> lectures){ renderItems(lectures); } }); .toList()
  • 21. 2121 Anatomia | AsyncTask -> Reactive .subscribe( new Subscriber<List<Lecture>>() { @Override public void onCompleted() { hideLoading(); } @Override public void onError(Throwable e) { Log.e(TAG, "onError: " + e.getMessage()); } @Override public void onNext(List<Lecture> lectures){ renderItems(lectures); } });
  • 22. 2222 new LectureAsyncTask().execute(); private class LectureAsyncTask extends AsyncTask<String, Void, List<Lecture>>{ @Override protected void onPreExecute() { showLoading(); } @Override protected List<Lecture> doInBackground(String... params){ return lectureService.getLectures(); } @Override protected void onPostExecute(List<Lecture> lectures){ hideLoading(); renderItems(lectures); } } Anatomia | AsyncTask -> Reactive .subscribe( new Subscriber<List<Lecture>>() { @Override public void onCompleted() { hideLoading(); } @Override public void onError(Throwable e) { Log.e(TAG, "onError: " + e.getMessage()); } @Override public void onNext(List<Lecture> lectures){ renderItems(lectures); } }); Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .toList()
  • 23. 2323 Exemplo | AsyncTask -> Reactive android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
  • 24. 2424 new LectureAsyncTask().execute(); private class LectureAsyncTask extends AsyncTask<String, Void, List<Lecture>>{ @Override protected void onPreExecute() { showLoading(); } @Override protected List<Lecture> doInBackground(String... params){ return lectureService.getLectures(); } @Override protected void onPostExecute(List<Lecture> lectures){ hideLoading(); renderItems(lectures); } } Exemplo | AsyncTask -> Reactive .subscribe( new Subscriber<List<Lecture>>() { @Override public void onCompleted() { hideLoading(); } @Override public void onError(Throwable e) { Log.e(TAG, "onError: " + e.getMessage()); } @Override public void onNext(List<Lecture> lectures){ renderItems(lectures); } }); .toList() Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io())
  • 25. 2525 Exemplo | AsyncTask -> Reactive .subscribe( new Subscriber<List<Lecture>>() { @Override public void onCompleted() { hideLoading(); } @Override public void onError(Throwable e) { Log.e(TAG, "onError: " + e.getMessage()); } @Override public void onNext(List<Lecture> lectures){ renderItems(lectures); } }); .observeOn(AndroidSchedulers.mainThread()) Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .toList()
  • 26. 2626 Exemplo | RxJava .subscribe(new Subscriber(){…}); .observeOn(AndroidSchedulers.mainThread()) Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .toList()
  • 29. 2929 Operator | Filter .filter(new Func1<Lecture, Boolean>() { @Override public Boolean call(Lecture lecture) { return lecture.getDay().equalsIgnoreCase(day); } }) .subscribe(new Subscriber(){…}); .observeOn(AndroidSchedulers.mainThread()) Observable.from(lectureService.getLectures()) .doOnSubscribe(showLoading()) .subscribeOn(Schedulers.io()) .toList()
  • 32. 3232 Observable<Lecture> observable = getLectures(); .map(new Func1<Lecture, String>() { @Override public String call(Lecture lecture) { return lecture.getDay(); } }) // Observable<String> .cast(CharSequence.class) // Observable<CharSequence> Operator | Map, Cast, Distinct… .distinct() // Mesmo Observable sem dados repetidos .toList() // Observable<List<CharSequence>> .subscribe(new Subscriber(){…}); observable
  • 33. 3333 Reactive Programming | Links https://github.com/ReactiveX/RxJava https://www.packtpub.com/application-development/rxjava-essentials http://rxmarbles.com
  • 35. OBRIGADO. Big Brains Wanted Join our team! Go to arctouch.com/brjobs Visit our booth to win an Apple Watch.

Editor's Notes

  1. 1 min
  2. Reactive Programming is a programming paradigm based on concept of an asynchronous data flow. Like a river: it can be observed, filtered, manipulated, or merged with a second flow to create a new flow for a new consumer. nstead of asking for a result and waiting, the developer simply asks for result and gets notified when result is available. Clearly more flexible, because from a logical and practical point of view, the developer can simply ignore if the data he needs comes sync or async, his code will still work.
  3. Functional reactive programming idea from late 90s inspired Erik Meijer. Rx is a reactive extension for .NET which provides an easy way to create async, event-driven programs using Observables sequences. Model a data stream using Observables, query and manage concurrency using Schedulers. Instead of asking for a result and waiting, the developer simply asks for result and gets notified when result is available. Clearly more flexible, because from a logical and practical point of view, the developer can simply ignore if the data he needs comes sync or async, his code will still work.
  4. 5min
  5. Behavioral pattern and ir provides a way to bind objects in a one-to-many dependency.: when one object changes, all the objects depending on it are notified and updated automatically. RxJava Observables can be composed instead of nested, saving the developer from the callback hell.
  6. Clear sequence of events that are going to happen. For every event the developer provides a reaction. Three missing abilities: The producer can now signal that there is no more data available: onCompleted() event. The producer can now signal that an error occurred.
  7. It adds three
  8. 10min