SlideShare uma empresa Scribd logo
1 de 88
Baixar para ler offline
Reactive programming on 
Android 
TomĂĄĆĄ Kypta
What’s reactive programming? 
reactive programming or functional reactive 
programming (FRP)
What’s reactive programming? 
functional 
– lambdas 
– closures 
– pure 
– composable 
reactive 
– data flow 
– asynchronous 
– values 
– events 
– push
Reactive? 
‱ observer pattern
Typical App 
Event Source 
Views Network DB Other 
Listener Listener Listener Listener 
logic logic logic logic 
State
Views Network DB 
Transformation 
Reactive 
Event Source 
Other 
Observable Observable Observable Observable 
Observer Observer
Reactive 
‱ abstract away from concerns about 
– low-level threading 
– side effects 
– synchronization 
– encapsulation 
– resource management
Java 8 
Observable.toObservable(“a”, “b”, “c”) 
.take(2) 
.subscribe((arg) -> { 
System.out.println(arg); 
}); 
Reactive Code
Reactive on Android 
‱ evading callback hell 
‱ How to execute heavy tasks on 
background threads? 
‱ And deliver results on the main (UI) 
thread?
Async on Android
Handler handler = new Handler(); 
new Thread(){ 
@Override 
public void run() { 
final String result = somethingDemanding(); 
handler.post(new Runnable() { 
@Override 
public void run() { 
showResult(result); 
} 
}); 
} 
}.start(); 
Thread + Handler
Handler handler = new Handler(); 
new Thread(){ 
@Override 
public void run() { 
final String result = somethingDemanding(); 
handler.post(new Runnable() { 
@Override 
public void run() { 
showResult(result); 
} 
}); 
} 
}.start(); 
Thread + Handler
Thread + Handler 
‱ simple 
‱ difficult to deliver on the main thread 
‱ broken data flow
new AsyncTask<Void, Integer, String>(){ 
@Override 
protected String doInBackground(Void... 
params) { 
return somethingDemanding(); 
} 
@Override 
protected void onPostExecute(String s) { 
showResult(s); 
} 
}.execute(); 
AsyncTask
AsyncTask 
‱ deals with the main thread 
‱ error-prone 
‱ difficult error propagation 
‱ difficult to bound to activity/fragment 
lifecycle 
‱ difficult composition
class MyFragment extends Fragment implements 
LoaderManager.LoaderCallbacks<String> { 
@Override public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
getLoaderManager().initLoader(42, null, this); 
} 
@Override public Loader<String> onCreateLoader(int id, Bundle args) { 
return new AsyncTaskLoader<String>(getActivity()) { 
@Override public String loadInBackground() { 
return doHeavyTask(); 
} 
}; 
} 
@Override public void onLoadFinished(Loader<String> loader, String data) { 
showResult(data); 
} 
@Override public void onLoaderReset(Loader<String> loader) {} 
} 
Loaders
Loaders
Loaders 
‱ boilerplate 
‱ good for cursors 
‱ deals with activity/fragment lifecycle 
‱ difficult composition 
‱ difficult to adjust logic
Async on Android 
‱ many other async libraries 
– some are better 
– some are worse
RxJava
RxJava 
‱ Java VM implementation of Reactive 
Extensions 
‱ a library for composing flows and 
sequences of asynchronous data 
‱ open-source 
‱ https://github.com/ReactiveX/RxJava 
‱ by Netflix
RxJava 
‱ DSL for creating computation flows from 
async sources 
‱ flows called Observables 
‱ push semantics of Observables
RxJava 
 not sure if 

Future 
proxy or wrapper around an object that is not 
yet there 
future.get() 
future.isDone() 
‱ non-trivial complexity when nested 
‱ difficult to compose conditional 
asynchronous execution flows
Iterable vs. Observable
Iterable vs. Observable 
// Iterable<String> 
getData() 
.skip(10) 
.take(5) 
.map({s -> 
return s + “1”}) 
.forEach({ 
println it 
}); 
// Observable<String> 
getData() 
.skip(10) 
.take(5) 
.map({s -> 
return s + “1”}) 
.subscribe({ 
println it 
});
Iterable vs. Observable 
single items multiple items 
synchronous T getData() Iterable<T> getData() 
asynchronous Future<T> getData() Observable<T> getData()
Iterable vs. Observable 
event Iterable (pull) Observable (push) 
retrieve data T next() onNext(T) 
discover error throws Exception onError(Exception) 
complete !hasNext() onCompleted()
Observable 
Calling Thread 
public Observable<String> getData(); 
Callback Thread 
synchronous on calling thread
Observable 
Calling Thread 
public Observable<String> getData(); 
Callback Thread 
Thread Pool 
asynchronous on a separate thread
Observable 
Calling Thread 
public Observable<String> getData(); 
Callback Threads 
Thread Pool 
asynchronous on multiple threads
Observable 
‱ not biased toward some particular source 
of asynchronicity 
‱ the implementation chooses if the code will 
be blocking or non-blocking
public interface Observer <T> { 
void onCompleted(); 
void onError(Throwable throwable); 
void onNext(T t); 
} 
Observable
public Observable<String> getStrings() { 
return Observable.create(new Observable.OnSubscribe<String>() { 
@Override 
public void call(Subscriber<? super String> subscriber) { 
try { 
subscriber.onNext("Hello"); 
subscriber.onNext("World"); 
subscriber.onCompleted(); 
} catch (Exception ex) { 
subscriber.onError(ex); 
} 
} 
}); 
} 
Observable
Observable<String> strings = getStrings(); 
strings.subscribe( 
new Observer<String>() { 
@Override 
public void onCompleted() { 
Log.d("rx", "no more data"); 
} 
@Override 
public void onError(Throwable throwable) { 
Log.e(“rx”, “error”, throwable); 
} 
@Override 
public void onNext(String s) { 
showResult(s); 
} 
}); 
Observer
Observable<String> strings = getStrings(); 
strings.subscribe( 
new Observer<String>() { 
@Override 
public void onCompleted() { 
Log.d("rx", "no more data"); 
} 
@Override 
public void onError(Throwable throwable) { 
Log.e(“rx”, “error”, throwable); 
} 
@Override 
public void onNext(String s) { 
showResult(s); 
} 
}); 
Observer
Observable<String> strings = getStrings(); 
strings.subscribe( 
new Observer<String>() { 
@Override 
public void onCompleted() { 
Log.d("rx", "no more data"); 
} 
@Override 
public void onError(Throwable throwable) { 
Log.e(“rx”, “error”, throwable); 
} 
@Override 
public void onNext(String s) { 
showResult(s); 
} 
}); 
Observer
Observable<String> strings = getStrings(); 
strings.subscribe( 
new Observer<String>() { 
@Override 
public void onCompleted() { 
Log.d("rx", "no more data"); 
} 
@Override 
public void onError(Throwable throwable) { 
Log.e(“rx”, “error”, throwable); 
} 
@Override 
public void onNext(String s) { 
showResult(s); 
} 
}); 
Observer
Observable<String> strings = getStrings(); 
Subscription subsctiption = strings.subscribe( 
new Observer<String>() { 
@Override 
public void onCompleted() { 
Log.d("rx", "no more data"); 
} 
@Override 
public void onError(Throwable throwable) { 
Log.e(“rx”, “error”, throwable); 
} 
@Override 
public void onNext(String s) { 
showResult(s); 
} 
}); 
Observer
Subscription 
Subscription subsctiption; 
subscription.unsubscribe(); 
subscription.isUnsubscribed();
Android & RxJava
RxAndroid 
Android specific things for Rx 
‱ Scheduler 
‱ reliable and thread-safe with regarding 
Fragment/Activity life-cycle 
‱ reactive components for Android use cases 
and UI
RxAndroid 
‱ https://github.com/ReactiveX/RxAndroid 
‱ 'io.reactivex:rxandroid:0.23.0' 
‱ formerly rxjava-android
Image Loading 
Observable<Bitmap> imageObservable = 
Observable.create(observer -> { 
return downloadBitmap(); 
}); 
imageObservable 
.subscribe(image -> loadToImageView(image));
Image Loading 
Observable<Bitmap> imageObservable = 
Observable.create(observer -> { 
return downloadBitmap(); 
}); 
imageObservable 
.subscribe(image -> loadToImageView(image));
Image Loading 
imageObservable 
.subscribeOn(Schedulers.newThread()) 
.subscribe(image -> loadToImageView(image));
Image Loading 
imageObservable 
.subscribeOn(Schedulers.newThread()) 
.observeOn(AndroidSchedulers.mainThread()) 
.subscribe(image -> loadToImageView(image));
Image Loading 
imageObservable 
.subscribeOn(Schedulers.newThread()) 
.observeOn(AndroidSchedulers.mainThread()) 
.subscribe(image -> loadToImageView(image));
public void onDestroy() { 
super.onDestroy(); 
subscription.unsubscribe(); 
} 
Lifecycle & Memory Leaks
Fragment/Activity Lifecycle 
ContentObservable 
.bindFragment(fragment, observable); 
ContentObservable 
.bindActivity(activity, observable);
Broadcast Receiver 
Observable<Intent> observable = 
ContentObservable 
.fromBroadcast(context, intentFilter); 
Observable<Intent> observable = 
ContentObservable 
.fromLocalBroadcast(context, intentFilter);
Views 
Observable<OnClickEvent> observable = 
ViewObservable.clicks(view); 
ViewObservable 
.bindView(view, observable);
Creating Observables
Creating Observables 
‱ manually from scratch 
create()
Creating Observables 
‱ convert existing data structure into an 
Observable 
from() 
– Iterable, Future, Array 
repeat() 
– emit source Observable repeatedly
Creating Observables 
‱ convert existing data structure into an 
Observable 
timer() 
– emits a single item after a given time
Creating Observables 
‱ convert existing data structure into an 
Observable 
empty() 
– emits nothing and completes 
error() 
– emits nothing and signals an error 
never() 
– emits nothing at all
Obervables are composable 
transform - map, flatMap, reduce, scan 
filter - take, skip, sample, filter 
combine - concat, merge, zip, cache 
concurrency - observeOn, subcribeOn 
error handling - onErrorReturn
Transforming Observables
Transforming Observables 
map() 
– apply a function to each item
Transforming Observables 
flatMap() 
– transform items into Observables and 
flatten
Transforming Observables 
scan() 
– apply a function to each item 
sequentially and emit each successive 
value
Transforming Observables 
groupBy() 
– divide into a set of Observables
Transforming Observables 
buffer() 
– periodically gather items into bundles 
and emits these bundles
Filtering Observables
Filtering Observable 
filter() 
– filter emitted items
Filtering Observable 
take() 
– emit only first n items
Filtering Observable 
timeout() 
– emit items, but issue an exception if 
nothing emitted in a timespan
Filtering Observable 
distinct() 
– suppress duplicate items
Filtering Observable 
takeLastBuffer() 
first() 
elementAt() 
– emit only n-th element 
ignoreElements() 
– pass only error or completed
Combining Observables
Combining Observables 
merge() 
– combine multiple Observables
Combining Observables 
zip() 
– combine multiple Observables via a 
function, emit results of the function
Error Handling
Error Handling 
recovering from onError() 
onErrorResumeNext() 
– emit a sequence if error happens
Error Handling 
onErrorReturn() 
– emit an item if error happens
Error Handling 
retry() 
– resubscribe to a source
Support for RxJava in other 
libraries
Retrofit 
@GET("/user/{id}/photo") 
Observable<Photo> getUserPhoto(@Path("id") int id);
private Object simpleMethod() { ... } 
public Observable<Object> newMethod() { 
return Observable.just(simpleMethod()); 
} 
Plain old library
private Object simpleMethod() { ... } 
public Observable<Object> newMethod() { 
return Observable.defer(() -> 
Observable.just(simpleMethod()) 
); 
} 
Plain old library
Java 8 & Android 
No lambdas on Android 
– use different language on Android 
– or rather not
Retrolambda 
transforms Java 8 compiled bytecode for 
older JVM 
‱ gradle-retrolambda 
– https://github.com/evant/gradle-retrolambda 
– 'me.tatarka:gradle-retrolambda:2.4.1' 
‱ retrolambda 
– https://github.com/orfjackal/retrolambda
strings.map(new Func1<String, Integer>() { 
@Override 
public Integer call(String s) { 
return s.length(); 
} 
}); 
Without Retrolambda
strings.map( 
(String s) -> { return s.length(); } 
); 
With Retrolambda
Problems 
‱ RxAndroid APIs not yet stabilized even 
though RxJava hitting version 1.0 
– RxAndroid version 0.23 
‱ backpressure
Questions?
THE END

Mais conteĂșdo relacionado

Mais procurados

Spark stream - Kafka
Spark stream - Kafka Spark stream - Kafka
Spark stream - Kafka Dori Waldman
 
Deep Dive with Spark Streaming - Tathagata Das - Spark Meetup 2013-06-17
Deep Dive with Spark Streaming - Tathagata  Das - Spark Meetup 2013-06-17Deep Dive with Spark Streaming - Tathagata  Das - Spark Meetup 2013-06-17
Deep Dive with Spark Streaming - Tathagata Das - Spark Meetup 2013-06-17spark-project
 
Easy, scalable, fault tolerant stream processing with structured streaming - ...
Easy, scalable, fault tolerant stream processing with structured streaming - ...Easy, scalable, fault tolerant stream processing with structured streaming - ...
Easy, scalable, fault tolerant stream processing with structured streaming - ...Databricks
 
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Event sourcing  - what could possibly go wrong ? Devoxx PL 2021Event sourcing  - what could possibly go wrong ? Devoxx PL 2021
Event sourcing - what could possibly go wrong ? Devoxx PL 2021Andrzej Ludwikowski
 
Apache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing dataApache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing dataDataWorks Summit/Hadoop Summit
 
Automated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative InfrastructureAutomated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative InfrastructureSpark Summit
 
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...Databricks
 
Harnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache TwillHarnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache TwillTerence Yim
 
Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017Petr Zapletal
 
Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch - Dynami...
Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch -  Dynami...Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch -  Dynami...
Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch - Dynami...Flink Forward
 
Introduction to rx java for android
Introduction to rx java for androidIntroduction to rx java for android
Introduction to rx java for androidEsa Firman
 
Spark streaming: Best Practices
Spark streaming: Best PracticesSpark streaming: Best Practices
Spark streaming: Best PracticesPrakash Chockalingam
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streamsconfluent
 
Deep dive into stateful stream processing in structured streaming by Tathaga...
Deep dive into stateful stream processing in structured streaming  by Tathaga...Deep dive into stateful stream processing in structured streaming  by Tathaga...
Deep dive into stateful stream processing in structured streaming by Tathaga...Databricks
 
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Lightbend
 
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Lightbend
 
Flink 0.10 @ Bay Area Meetup (October 2015)
Flink 0.10 @ Bay Area Meetup (October 2015)Flink 0.10 @ Bay Area Meetup (October 2015)
Flink 0.10 @ Bay Area Meetup (October 2015)Stephan Ewen
 
Building production spark streaming applications
Building production spark streaming applicationsBuilding production spark streaming applications
Building production spark streaming applicationsJoey Echeverria
 
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...Dan Halperin
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Anton Kirillov
 

Mais procurados (20)

Spark stream - Kafka
Spark stream - Kafka Spark stream - Kafka
Spark stream - Kafka
 
Deep Dive with Spark Streaming - Tathagata Das - Spark Meetup 2013-06-17
Deep Dive with Spark Streaming - Tathagata  Das - Spark Meetup 2013-06-17Deep Dive with Spark Streaming - Tathagata  Das - Spark Meetup 2013-06-17
Deep Dive with Spark Streaming - Tathagata Das - Spark Meetup 2013-06-17
 
Easy, scalable, fault tolerant stream processing with structured streaming - ...
Easy, scalable, fault tolerant stream processing with structured streaming - ...Easy, scalable, fault tolerant stream processing with structured streaming - ...
Easy, scalable, fault tolerant stream processing with structured streaming - ...
 
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Event sourcing  - what could possibly go wrong ? Devoxx PL 2021Event sourcing  - what could possibly go wrong ? Devoxx PL 2021
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
 
Apache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing dataApache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing data
 
Automated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative InfrastructureAutomated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative Infrastructure
 
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
Deep Dive into Stateful Stream Processing in Structured Streaming with Tathag...
 
Harnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache TwillHarnessing the power of YARN with Apache Twill
Harnessing the power of YARN with Apache Twill
 
Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017Distributed Stream Processing - Spark Summit East 2017
Distributed Stream Processing - Spark Summit East 2017
 
Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch - Dynami...
Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch -  Dynami...Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch -  Dynami...
Flink Forward SF 2017: David Hardwick, Sean Hester & David Brelloch - Dynami...
 
Introduction to rx java for android
Introduction to rx java for androidIntroduction to rx java for android
Introduction to rx java for android
 
Spark streaming: Best Practices
Spark streaming: Best PracticesSpark streaming: Best Practices
Spark streaming: Best Practices
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streams
 
Deep dive into stateful stream processing in structured streaming by Tathaga...
Deep dive into stateful stream processing in structured streaming  by Tathaga...Deep dive into stateful stream processing in structured streaming  by Tathaga...
Deep dive into stateful stream processing in structured streaming by Tathaga...
 
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
 
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
Build Real-Time Streaming ETL Pipelines With Akka Streams, Alpakka And Apache...
 
Flink 0.10 @ Bay Area Meetup (October 2015)
Flink 0.10 @ Bay Area Meetup (October 2015)Flink 0.10 @ Bay Area Meetup (October 2015)
Flink 0.10 @ Bay Area Meetup (October 2015)
 
Building production spark streaming applications
Building production spark streaming applicationsBuilding production spark streaming applications
Building production spark streaming applications
 
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
 

Destaque

xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonClaudiu Barbura
 
Reactive streams
Reactive streamsReactive streams
Reactive streamscodepitbull
 
Reactive Jersey Client
Reactive Jersey ClientReactive Jersey Client
Reactive Jersey ClientMichal Gajdos
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingAhmed Soliman
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsNLJUG
 
Reactive Streams and RabbitMQ
Reactive Streams and RabbitMQReactive Streams and RabbitMQ
Reactive Streams and RabbitMQmkiedys
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeRoland Kuhn
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Izzet Mustafaiev
 
Tachyon and Apache Spark
Tachyon and Apache SparkTachyon and Apache Spark
Tachyon and Apache Sparkrhatr
 
Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014Björn Antonsson
 
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)Claudiu Barbura
 
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsMicro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsDejan Glozic
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM DeploymentJoe Kutner
 

Destaque (13)

xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
 
Reactive streams
Reactive streamsReactive streams
Reactive streams
 
Reactive Jersey Client
Reactive Jersey ClientReactive Jersey Client
Reactive Jersey Client
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function Programming
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
 
Reactive Streams and RabbitMQ
Reactive Streams and RabbitMQReactive Streams and RabbitMQ
Reactive Streams and RabbitMQ
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
 
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?
 
Tachyon and Apache Spark
Tachyon and Apache SparkTachyon and Apache Spark
Tachyon and Apache Spark
 
Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014
 
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
 
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factorsMicro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factors
 
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment
 

Semelhante a Reactive programming on 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
 
Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
 Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at... Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...Big Data Spain
 
RxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐž
RxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐžRxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐž
RxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐžStfalcon Meetups
 
Non Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaNon Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaFrank Lyaruu
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomĂĄĆĄ Kypta
 
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
 
Painless Persistence with Realm
Painless Persistence with RealmPainless Persistence with Realm
Painless Persistence with RealmChristian Melchior
 
Intro to Reactive Thinking and RxJava 2
Intro to Reactive Thinking and RxJava 2Intro to Reactive Thinking and RxJava 2
Intro to Reactive Thinking and RxJava 2JollyRogers5
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSAdam L Barrett
 
Tech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn TớiTech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn TớiNexus FrontierTech
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...julien.ponge
 
Don't Wait! Develop Responsive Applications with Java EE7 Instead
Don't Wait! Develop Responsive Applications with Java EE7 InsteadDon't Wait! Develop Responsive Applications with Java EE7 Instead
Don't Wait! Develop Responsive Applications with Java EE7 InsteadWASdev Community
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Paco de la Cruz
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011Oleg Podsechin
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidEmanuele Di Saverio
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 SlidesYarikS
 
PigSPARQL: A SPARQL Query Processing Baseline for Big Data
PigSPARQL: A SPARQL Query Processing Baseline for Big DataPigSPARQL: A SPARQL Query Processing Baseline for Big Data
PigSPARQL: A SPARQL Query Processing Baseline for Big DataAlexander SchÀtzle
 

Semelhante a Reactive programming on 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
 
Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
 Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at... Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
 
RxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐž
RxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐžRxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐž
RxJava Đž Android. ĐŸĐ»ŃŽŃŃ‹, ĐŒĐžĐœŃƒŃŃ‹, ĐżĐŸĐŽĐČĐŸĐŽĐœŃ‹Đ” ĐșĐ°ĐŒĐœĐž
 
Non Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaNon Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJava
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
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...
 
Painless Persistence with Realm
Painless Persistence with RealmPainless Persistence with Realm
Painless Persistence with Realm
 
Intro to Reactive Thinking and RxJava 2
Intro to Reactive Thinking and RxJava 2Intro to Reactive Thinking and RxJava 2
Intro to Reactive Thinking and RxJava 2
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
Tech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn TớiTech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - DÆ°ÆĄng Văn Tới
 
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
Java 7 Launch Event at LyonJUG, Lyon France. Fork / Join framework and Projec...
 
Don't Wait! Develop Responsive Applications with Java EE7 Instead
Don't Wait! Develop Responsive Applications with Java EE7 InsteadDon't Wait! Develop Responsive Applications with Java EE7 Instead
Don't Wait! Develop Responsive Applications with Java EE7 Instead
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 Slides
 
PigSPARQL: A SPARQL Query Processing Baseline for Big Data
PigSPARQL: A SPARQL Query Processing Baseline for Big DataPigSPARQL: A SPARQL Query Processing Baseline for Big Data
PigSPARQL: A SPARQL Query Processing Baseline for Big Data
 

Mais de TomĂĄĆĄ Kypta

Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworksTomĂĄĆĄ Kypta
 
Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworksTomĂĄĆĄ Kypta
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomĂĄĆĄ Kypta
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomĂĄĆĄ Kypta
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomĂĄĆĄ Kypta
 
Android Develpment vol. 3, MFF UK, 2015
Android Develpment vol. 3, MFF UK, 2015Android Develpment vol. 3, MFF UK, 2015
Android Develpment vol. 3, MFF UK, 2015TomĂĄĆĄ Kypta
 
Writing testable Android apps
Writing testable Android appsWriting testable Android apps
Writing testable Android appsTomĂĄĆĄ Kypta
 
Android Develpment vol. 2, MFF UK, 2015
Android Develpment vol. 2, MFF UK, 2015Android Develpment vol. 2, MFF UK, 2015
Android Develpment vol. 2, MFF UK, 2015TomĂĄĆĄ Kypta
 
Unit testing and Android
Unit testing and AndroidUnit testing and Android
Unit testing and AndroidTomĂĄĆĄ Kypta
 
Android Development for Phone and Tablet
Android Development for Phone and TabletAndroid Development for Phone and Tablet
Android Development for Phone and TabletTomĂĄĆĄ Kypta
 
Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014TomĂĄĆĄ Kypta
 
Android Development 201
Android Development 201Android Development 201
Android Development 201TomĂĄĆĄ Kypta
 
Android development - the basics, MFF UK, 2013
Android development - the basics, MFF UK, 2013Android development - the basics, MFF UK, 2013
Android development - the basics, MFF UK, 2013TomĂĄĆĄ Kypta
 
UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­
UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­
UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­TomĂĄĆĄ Kypta
 
ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013
ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013
ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013TomĂĄĆĄ Kypta
 
StylovĂĄnĂ­ ActionBaru
StylovĂĄnĂ­ ActionBaruStylovĂĄnĂ­ ActionBaru
StylovĂĄnĂ­ ActionBaruTomĂĄĆĄ Kypta
 
Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012TomĂĄĆĄ Kypta
 
Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012TomĂĄĆĄ Kypta
 

Mais de TomĂĄĆĄ Kypta (20)

Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworks
 
Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworks
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Android Develpment vol. 3, MFF UK, 2015
Android Develpment vol. 3, MFF UK, 2015Android Develpment vol. 3, MFF UK, 2015
Android Develpment vol. 3, MFF UK, 2015
 
Writing testable Android apps
Writing testable Android appsWriting testable Android apps
Writing testable Android apps
 
Android Develpment vol. 2, MFF UK, 2015
Android Develpment vol. 2, MFF UK, 2015Android Develpment vol. 2, MFF UK, 2015
Android Develpment vol. 2, MFF UK, 2015
 
ProGuard
ProGuardProGuard
ProGuard
 
Unit testing and Android
Unit testing and AndroidUnit testing and Android
Unit testing and Android
 
Android Development for Phone and Tablet
Android Development for Phone and TabletAndroid Development for Phone and Tablet
Android Development for Phone and Tablet
 
Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014
 
Android Libraries
Android LibrariesAndroid Libraries
Android Libraries
 
Android Development 201
Android Development 201Android Development 201
Android Development 201
 
Android development - the basics, MFF UK, 2013
Android development - the basics, MFF UK, 2013Android development - the basics, MFF UK, 2013
Android development - the basics, MFF UK, 2013
 
UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­
UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­
UĆŸitečnĂ© Android knihovny pro vĂœvoj a testovĂĄnĂ­
 
ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013
ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013
ProgramovĂĄnĂ­ pro Android - Ășvod, FI MUNI, 2013
 
StylovĂĄnĂ­ ActionBaru
StylovĂĄnĂ­ ActionBaruStylovĂĄnĂ­ ActionBaru
StylovĂĄnĂ­ ActionBaru
 
Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012
 
Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012Android development - the basics, FI MUNI, 2012
Android development - the basics, FI MUNI, 2012
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Reactive programming on Android

  • 1. Reactive programming on Android TomĂĄĆĄ Kypta
  • 2. What’s reactive programming? reactive programming or functional reactive programming (FRP)
  • 3. What’s reactive programming? functional – lambdas – closures – pure – composable reactive – data flow – asynchronous – values – events – push
  • 5. Typical App Event Source Views Network DB Other Listener Listener Listener Listener logic logic logic logic State
  • 6. Views Network DB Transformation Reactive Event Source Other Observable Observable Observable Observable Observer Observer
  • 7. Reactive ‱ abstract away from concerns about – low-level threading – side effects – synchronization – encapsulation – resource management
  • 8. Java 8 Observable.toObservable(“a”, “b”, “c”) .take(2) .subscribe((arg) -> { System.out.println(arg); }); Reactive Code
  • 9. Reactive on Android ‱ evading callback hell ‱ How to execute heavy tasks on background threads? ‱ And deliver results on the main (UI) thread?
  • 11. Handler handler = new Handler(); new Thread(){ @Override public void run() { final String result = somethingDemanding(); handler.post(new Runnable() { @Override public void run() { showResult(result); } }); } }.start(); Thread + Handler
  • 12. Handler handler = new Handler(); new Thread(){ @Override public void run() { final String result = somethingDemanding(); handler.post(new Runnable() { @Override public void run() { showResult(result); } }); } }.start(); Thread + Handler
  • 13. Thread + Handler ‱ simple ‱ difficult to deliver on the main thread ‱ broken data flow
  • 14. new AsyncTask<Void, Integer, String>(){ @Override protected String doInBackground(Void... params) { return somethingDemanding(); } @Override protected void onPostExecute(String s) { showResult(s); } }.execute(); AsyncTask
  • 15. AsyncTask ‱ deals with the main thread ‱ error-prone ‱ difficult error propagation ‱ difficult to bound to activity/fragment lifecycle ‱ difficult composition
  • 16. class MyFragment extends Fragment implements LoaderManager.LoaderCallbacks<String> { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getLoaderManager().initLoader(42, null, this); } @Override public Loader<String> onCreateLoader(int id, Bundle args) { return new AsyncTaskLoader<String>(getActivity()) { @Override public String loadInBackground() { return doHeavyTask(); } }; } @Override public void onLoadFinished(Loader<String> loader, String data) { showResult(data); } @Override public void onLoaderReset(Loader<String> loader) {} } Loaders
  • 18. Loaders ‱ boilerplate ‱ good for cursors ‱ deals with activity/fragment lifecycle ‱ difficult composition ‱ difficult to adjust logic
  • 19. Async on Android ‱ many other async libraries – some are better – some are worse
  • 21. RxJava ‱ Java VM implementation of Reactive Extensions ‱ a library for composing flows and sequences of asynchronous data ‱ open-source ‱ https://github.com/ReactiveX/RxJava ‱ by Netflix
  • 22. RxJava ‱ DSL for creating computation flows from async sources ‱ flows called Observables ‱ push semantics of Observables
  • 23. RxJava 
 not sure if 

  • 24. Future proxy or wrapper around an object that is not yet there future.get() future.isDone() ‱ non-trivial complexity when nested ‱ difficult to compose conditional asynchronous execution flows
  • 26. Iterable vs. Observable // Iterable<String> getData() .skip(10) .take(5) .map({s -> return s + “1”}) .forEach({ println it }); // Observable<String> getData() .skip(10) .take(5) .map({s -> return s + “1”}) .subscribe({ println it });
  • 27. Iterable vs. Observable single items multiple items synchronous T getData() Iterable<T> getData() asynchronous Future<T> getData() Observable<T> getData()
  • 28. Iterable vs. Observable event Iterable (pull) Observable (push) retrieve data T next() onNext(T) discover error throws Exception onError(Exception) complete !hasNext() onCompleted()
  • 29. Observable Calling Thread public Observable<String> getData(); Callback Thread synchronous on calling thread
  • 30. Observable Calling Thread public Observable<String> getData(); Callback Thread Thread Pool asynchronous on a separate thread
  • 31. Observable Calling Thread public Observable<String> getData(); Callback Threads Thread Pool asynchronous on multiple threads
  • 32. Observable ‱ not biased toward some particular source of asynchronicity ‱ the implementation chooses if the code will be blocking or non-blocking
  • 33. public interface Observer <T> { void onCompleted(); void onError(Throwable throwable); void onNext(T t); } Observable
  • 34. public Observable<String> getStrings() { return Observable.create(new Observable.OnSubscribe<String>() { @Override public void call(Subscriber<? super String> subscriber) { try { subscriber.onNext("Hello"); subscriber.onNext("World"); subscriber.onCompleted(); } catch (Exception ex) { subscriber.onError(ex); } } }); } Observable
  • 35. Observable<String> strings = getStrings(); strings.subscribe( new Observer<String>() { @Override public void onCompleted() { Log.d("rx", "no more data"); } @Override public void onError(Throwable throwable) { Log.e(“rx”, “error”, throwable); } @Override public void onNext(String s) { showResult(s); } }); Observer
  • 36. Observable<String> strings = getStrings(); strings.subscribe( new Observer<String>() { @Override public void onCompleted() { Log.d("rx", "no more data"); } @Override public void onError(Throwable throwable) { Log.e(“rx”, “error”, throwable); } @Override public void onNext(String s) { showResult(s); } }); Observer
  • 37. Observable<String> strings = getStrings(); strings.subscribe( new Observer<String>() { @Override public void onCompleted() { Log.d("rx", "no more data"); } @Override public void onError(Throwable throwable) { Log.e(“rx”, “error”, throwable); } @Override public void onNext(String s) { showResult(s); } }); Observer
  • 38. Observable<String> strings = getStrings(); strings.subscribe( new Observer<String>() { @Override public void onCompleted() { Log.d("rx", "no more data"); } @Override public void onError(Throwable throwable) { Log.e(“rx”, “error”, throwable); } @Override public void onNext(String s) { showResult(s); } }); Observer
  • 39. Observable<String> strings = getStrings(); Subscription subsctiption = strings.subscribe( new Observer<String>() { @Override public void onCompleted() { Log.d("rx", "no more data"); } @Override public void onError(Throwable throwable) { Log.e(“rx”, “error”, throwable); } @Override public void onNext(String s) { showResult(s); } }); Observer
  • 40. Subscription Subscription subsctiption; subscription.unsubscribe(); subscription.isUnsubscribed();
  • 42. RxAndroid Android specific things for Rx ‱ Scheduler ‱ reliable and thread-safe with regarding Fragment/Activity life-cycle ‱ reactive components for Android use cases and UI
  • 43. RxAndroid ‱ https://github.com/ReactiveX/RxAndroid ‱ 'io.reactivex:rxandroid:0.23.0' ‱ formerly rxjava-android
  • 44. Image Loading Observable<Bitmap> imageObservable = Observable.create(observer -> { return downloadBitmap(); }); imageObservable .subscribe(image -> loadToImageView(image));
  • 45. Image Loading Observable<Bitmap> imageObservable = Observable.create(observer -> { return downloadBitmap(); }); imageObservable .subscribe(image -> loadToImageView(image));
  • 46. Image Loading imageObservable .subscribeOn(Schedulers.newThread()) .subscribe(image -> loadToImageView(image));
  • 47. Image Loading imageObservable .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(image -> loadToImageView(image));
  • 48. Image Loading imageObservable .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(image -> loadToImageView(image));
  • 49. public void onDestroy() { super.onDestroy(); subscription.unsubscribe(); } Lifecycle & Memory Leaks
  • 50. Fragment/Activity Lifecycle ContentObservable .bindFragment(fragment, observable); ContentObservable .bindActivity(activity, observable);
  • 51. Broadcast Receiver Observable<Intent> observable = ContentObservable .fromBroadcast(context, intentFilter); Observable<Intent> observable = ContentObservable .fromLocalBroadcast(context, intentFilter);
  • 52. Views Observable<OnClickEvent> observable = ViewObservable.clicks(view); ViewObservable .bindView(view, observable);
  • 54. Creating Observables ‱ manually from scratch create()
  • 55. Creating Observables ‱ convert existing data structure into an Observable from() – Iterable, Future, Array repeat() – emit source Observable repeatedly
  • 56. Creating Observables ‱ convert existing data structure into an Observable timer() – emits a single item after a given time
  • 57. Creating Observables ‱ convert existing data structure into an Observable empty() – emits nothing and completes error() – emits nothing and signals an error never() – emits nothing at all
  • 58. Obervables are composable transform - map, flatMap, reduce, scan filter - take, skip, sample, filter combine - concat, merge, zip, cache concurrency - observeOn, subcribeOn error handling - onErrorReturn
  • 60. Transforming Observables map() – apply a function to each item
  • 61. Transforming Observables flatMap() – transform items into Observables and flatten
  • 62. Transforming Observables scan() – apply a function to each item sequentially and emit each successive value
  • 63. Transforming Observables groupBy() – divide into a set of Observables
  • 64. Transforming Observables buffer() – periodically gather items into bundles and emits these bundles
  • 66. Filtering Observable filter() – filter emitted items
  • 67. Filtering Observable take() – emit only first n items
  • 68. Filtering Observable timeout() – emit items, but issue an exception if nothing emitted in a timespan
  • 69. Filtering Observable distinct() – suppress duplicate items
  • 70. Filtering Observable takeLastBuffer() first() elementAt() – emit only n-th element ignoreElements() – pass only error or completed
  • 72. Combining Observables merge() – combine multiple Observables
  • 73. Combining Observables zip() – combine multiple Observables via a function, emit results of the function
  • 75. Error Handling recovering from onError() onErrorResumeNext() – emit a sequence if error happens
  • 76. Error Handling onErrorReturn() – emit an item if error happens
  • 77. Error Handling retry() – resubscribe to a source
  • 78. Support for RxJava in other libraries
  • 79. Retrofit @GET("/user/{id}/photo") Observable<Photo> getUserPhoto(@Path("id") int id);
  • 80. private Object simpleMethod() { ... } public Observable<Object> newMethod() { return Observable.just(simpleMethod()); } Plain old library
  • 81. private Object simpleMethod() { ... } public Observable<Object> newMethod() { return Observable.defer(() -> Observable.just(simpleMethod()) ); } Plain old library
  • 82. Java 8 & Android No lambdas on Android – use different language on Android – or rather not
  • 83. Retrolambda transforms Java 8 compiled bytecode for older JVM ‱ gradle-retrolambda – https://github.com/evant/gradle-retrolambda – 'me.tatarka:gradle-retrolambda:2.4.1' ‱ retrolambda – https://github.com/orfjackal/retrolambda
  • 84. strings.map(new Func1<String, Integer>() { @Override public Integer call(String s) { return s.length(); } }); Without Retrolambda
  • 85. strings.map( (String s) -> { return s.length(); } ); With Retrolambda
  • 86. Problems ‱ RxAndroid APIs not yet stabilized even though RxJava hitting version 1.0 – RxAndroid version 0.23 ‱ backpressure