Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reactive Programming

Reactive Programming

Reactive Programming Talk @DevCon Yangon 2016. Reactive Programming explained with real world examples written in Java including Capturing Double Click, Loading Network and Cache Data and implementing AutoComplete Search

Aung Kyaw Paing

December 17, 2016
Tweet

More Decks by Aung Kyaw Paing

Other Decks in Programming

Transcript

  1. A little bit about myself • 2 years in Android

    Development • Have released a couple of apps • Android Dev at Nex • Final year CS student
  2. What’s Reactive Programming? Reactive programming is programming with asynchronous data

    streams. Source : https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
  3. What’s Reactive Programming? Reactive programming is programming with asynchronous data

    streams. Source : https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
  4. Capturing Double Click Step 1 : Capture click events in

    a stream Step 2 : Group click events within a time period Step 3 : Count the grouped click events in each time period Step 4 : Filter groups that contains 2 or more clicks
  5. Buffer Bundles data emitted by an observable within a time

    period and emit this bundle instead of the original data
  6. TakeUntil Discard data emitted by a observable after a second

    observable emits it first data or terminates
  7. Debounce Emits only if the observable after a period of

    time have passed without emitting a data
  8. Holy Trinity of RxConversation map R => T flatMap R

    => Observable<T> compose Observable<R> => Observable<T>
  9. Switchmap Switchmap works like Concatmap but it will immediately unsubscribe

    to pervious items emitted from the stream as soon as an observable emits an item into the stream
  10. Suggested Links The Introduction to Reactive Programming You’ve been missing

    https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 Exploring RxJava 2 for Android http://jakewharton.com/exploring-rxjava-2-for-android/ Learning Rx by example Part 1 & 2 https://www.youtube.com/watch?v=k3D0cWyNno4 https://vimeo.com/190922794 Rx-Android-Samples https://github.com/kaushikgopal/RxJava-Android-Samples Rxify Series https://medium.com/@ragdroid