Skip to content

(MVI) Model View Intent

Devrath edited this page May 30, 2021 · 19 revisions

Improvement from MVI towards a better Architecture

  • To overcome the drawbacks of MVC controller overloading with the business logic. Modifications were done to segregate it to a better representation of architecture called Model-View-Presenter.
  • It is a relatively new but popular approach to android application architecture.
  • MVP and MVVM are a little bit similar to MVC to MVI.
  • MVP and MVVM have presenter and view-model respectively to that of controller for MVC.
Contents
MVI specific concepts
How the concept of MVI came into existence
How MVI works
Overview representation of mvi

MVI specific concepts

  • Uni-directional data flow.
  • Immutable state.
  • User as a function.
  • Its way of simplifying the flow of information which leads to a comprehensive and systematic approach to architecture.

How the concept of MVI came into existence

  • Many of the advancements in recent times comes from the web-development world.
  • Some namely react, redux, flux, use event-driven and functional way of solving things.
  • They give a unique perspective on how to manage mutable state.
  • Such representation fits into mobile development applications.
  • MVI is closely associated with cycle.js from the web development world.

How MVI works

Most important part of the Architecture - User

  • Much of the code you write in web development is user focused instead of process intensive.
  • Architecture in android usually focus on the process instead of user. The code gives an interface to accept input and send input.
  • Place of the user in mvvm or mvp is not transparent. Usually, the user is the kind of view in these patterns.

In MVI user takes a central role in expressing their intents(intention).

Overview representation of MVI

* Application starts up and user starts interacting with it. * We call user interation intents meaning users intents on something to occur based on how they interact with the application. They might `type a text` or `click a button`. * Our software does something interesting using the intents(intention) of the user and models the data and the output is sent back to the user. * Thus there are **`intents as input**` and **`results as output`**.

Clone this wiki locally