The command pattern
The command pattern is a derivation of the flux pattern for reactive mobile applications. In the Android world, this pattern is implemented in a similar way under the name Model View Intent (MVI), whose sole purpose is creating a unidirectional flow of data and decreasing the complexities that stem from the duplex nature of Model–View–ViewMode (MVVM).
In this pattern, each view is equipped with multiple commands that are self-contained execution blocks with references to the underlying application infrastructure (similar to a unit of work). The user interaction in this case is routed to the respective command, and the command result is propagated to the concerned controls through broadcasts (for example, using the BroadcastReceiver ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access