A Great Way to do Android Presenters
Article Summary
Cash App's Android team chose presenters over ViewModels and MVVM. Here's why their "boring" code wins.
Benoît Quenaudon from Cash App shares their presenter pattern that uses RxJava to create a uniform, testable architecture. Every presenter follows the same contract: view events in, view models out.
Key Takeaways
- Single API: all presenters extend ObservableTransformer with one input and output stream
- Strict top-down data flow prevents the nightmare of reasoning about upward streams
- Navigation handled as side effects through Launcher interface, not view model emissions
- Testing simplified with fake implementations and RxJava's test observers
Critical Insight
A consistent presenter pattern with unidirectional data flow creates code that's easy to write, review, and test across the entire team.