Reactive Android Patterns
@colinmlee
Who Are You?
Colin Lee
Android Software Engineer
@ Colin The Shots LLC
Twitter: @colinmlee
Slides!
http://slides.com/colinlee/deck-2
All examples are at http://github.com/colintheshots
1. Retrofit Your Network
2. Reactive Database
3. Create() Your Own
4. Replacing AsyncTask
5. Hot vs Cold
6. When to Unsubscribe()
7. FlatMap() vs Map()
8. FlatMap() to Chain Retrofit
9. Forking Your Chain
10. Zip() All the Things!
11. Concat() All the Caches!
12. PublishSubject As Event Bus
13. BehaviorSubject for Tracking Values
14. RxBindings for Views
15. Debounce() to Autocomplete
16. TestScheduler
17. Compose() to
Re-Use
18. Observables As Finite State Machine
Gotchas
- No schedulers, RxJava is synchronous on main thread
- Use flatmap() instead of nesting subscribe callbacks
- Saving results to fields breaks functional contract
- Observable.just() and Observable.from() may block until parentheses are evaluated, use Observable.defer()
- Watch out for memory backpressure and ring buffer
- Unsubscribe when no longer needed
Questions?
Please take a moment to fill out
the class feedback form via the
app. Paper feedback forms are
also available in the back of the
room.
eventmobi.com/adcboston16
Reactive Android Patterns
By Colin Lee
Reactive Android Patterns
- 647