SlideShare a Scribd company logo
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

More Related Content

What's hot

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-17
spark-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 2021
Andrzej 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 data
DataWorks 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 Infrastructure
Spark 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 Twill
Terence 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 2017
Petr 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 android
Esa Firman
 
Spark streaming: Best Practices
Spark streaming: Best PracticesSpark streaming: Best Practices
Spark streaming: Best Practices
Prakash Chockalingam
 
Robust Operations of Kafka Streams
Robust Operations of Kafka StreamsRobust Operations of Kafka Streams
Robust Operations of Kafka Streams
confluent
 
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 applications
Joey 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
 

What's hot (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...
 

Viewers also liked

xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
Claudiu Barbura
 
Reactive streams
Reactive streamsReactive streams
Reactive streams
codepitbull
 
Reactive Jersey Client
Reactive Jersey ClientReactive Jersey Client
Reactive Jersey Client
Michal Gajdos
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function Programming
Ahmed 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 Practice
Roland 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 Spark
rhatr
 
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
Bjö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-factors
Dejan 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 Deployment
Joe Kutner
 

Viewers also liked (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
 

Similar to 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 RxJava
Rick 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 RxJava
Frank Lyaruu
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
Tomáš 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 Realm
Christian 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 2
JollyRogers5
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
Adam 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ới
Nexus 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 Instead
WASdev 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
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
Sébastien Prunier
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
 
RxJava2 Slides
RxJava2 SlidesRxJava2 Slides
RxJava2 Slides
YarikS
 
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
Alexander Schätzle
 

Similar to 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
 

More from 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 frameworks
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 frameworks
Tomáš Kypta
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
Tomáš Kypta
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
Tomáš Kypta
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
Tomáš 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, 2015
Tomáš Kypta
 
Writing testable Android apps
Writing testable Android appsWriting testable Android apps
Writing testable Android apps
Tomáš 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, 2015
Tomáš Kypta
 
ProGuard
ProGuardProGuard
ProGuard
Tomáš Kypta
 
Unit testing and Android
Unit testing and AndroidUnit testing and Android
Unit testing and Android
Tomáš Kypta
 
Android Development for Phone and Tablet
Android Development for Phone and TabletAndroid Development for Phone and Tablet
Android Development for Phone and Tablet
Tomáš 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, 2014
Tomáš Kypta
 
Android Libraries
Android LibrariesAndroid Libraries
Android Libraries
Tomáš Kypta
 
Android Development 201
Android Development 201Android Development 201
Android Development 201
Tomáš 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, 2013
Tomáš 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, 2013
Tomáš Kypta
 
Stylování ActionBaru
Stylování ActionBaruStylování ActionBaru
Stylování ActionBaru
Tomáš 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, 2012
Tomáš 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
 

More from 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
 

Recently uploaded

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 

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