Development on Android inevitably involves asynchronous sources, which includes the network, the framework or even the user. This easily leads to a complex architecture and a state that is difficult to manage. Are you comfortable with your users rotating the screen while waiting for a network response? What will happen when multiple requests hit the network at the same time?
The Model-View-Intent architecture, borrowed from the web, is all about streams: listening to asynchronous sources, processing the information, and displaying the result. In this architecture, everything is a stream. However, Android is a multi-threaded platform and this introduces additional complexity that we have to take into account when applying the MVI pattern. Unidirectional data flow allows one to focus on a unique source of truth and by embracing immutability, there is no need to worry about data being mutated by other parts of the code. By abstracting away the common pitfalls of state management in Android, this architecture allows the developer to focus on the logic of the app, making it easy to write and easy to maintain.
In this talk, we’ll look at how, with Kotlin and RxJava, this reactive architecture can help the developer write a complex UI with concrete examples, including parallel network requests, config changes, SnackBars and more.