Android Architecture.
Tags: android, architecture, flutter, programming
Published: 2022-10-04 08:51:54

**Android architecture** is a software stack of components to support mobile device needs. Android software stack contains a Linux Kernel, a collection of c/c++ libraries which are exposed through application framework services, runtime, and application.

People follow these patterns for great productivity.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ar5e5nebfkbmq51zr7sa.png)

---------------------------------

## 1. MVVM (Model View View Model):

**Model–View–ViewModel** is a software architectural pattern that facilitates the separation of the development of the graphical user interface. It provides data to UI and ViewModel to interact with the model and this is a good way to do code.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yizvcnr7kafiujoindq3.png)

**ADVANTAGES:**

- Easy to Understand.
- Good Productivity.
- Easy to Manage code.

**DISADVANTAGES:**

- It has a somewhat steep learning curve. How all the layers work together may take some time to understand.
- It adds a lot of extra classes, so it’s not ideal for low-complexity projects.

**Using MVVM in Flutter**
Flutter is declarative in nature. This means that Flutter builds UI by overriding your build methods to reflect the current state of your app:

> the data you need to rebuild your UI at any point in time.

A state can be contained in a single widget, known as a local state. Flutter provides inbuilt classes and methods to deal with self-contained states like StatefulWidget and setState.

**Naming Convention:**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b35a1g0vscdvne7howws.png)

---------------------------------

## 2. MVP (Model View Presenter):

**Model–View–Presenter** is a derivation of the model–view–controller architectural pattern, and is used mostly for building user interfaces. In MVP, the presenter assumes the functionality of the “middle-man”. In MVP, all presentation logic is pushed to the presenter

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pxouoj0oc1qlgjpz1kks.png)

**ADVANTAGES:**

- No Conceptual Relationship.
- Easy code Maintenance.
- Easy testing.

---------------------------------

## 3. MVI (Model View Intent):

**Model-View-Intent** (MVI) is reactive, functional, and follows the core idea in MVC. It is reactive because Intent observes the User, Model observes the Intent, View observes the Model, and the User observes the View. Intent pass data to model and model pass data to view and view show data to us.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p3h04crgrh2r96b56w3d.png)

**ADVANTAGES:**

- Easy to debug.
- Easy to understand data flow.

---------------------------------

## 4. MVC (Model View Controller):

**Model–view–controller** is a software architectural pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements. This is done to separate internal representations of information from the ways information is presented to and accepted by the user. MVC is as same as MVP and this pattern has a controller instead of a presenter.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cddtvs2x587nkl4w2pkv.png)

**ADVANTAGES:**

- Unity Testing.
- Model Controller.