Загрузка страницы

Why Model-View-Intent (MVI) is My NEW Favorite Architecture

Watch the Model-View-Intent (MVI) course: https://codingwithmitch.com/courses/model-view-intent-mvi-architecture/

In this video I talk about why Model-View-Intent (MVI) is my new favorite architecture and why you should consider taking a look at it.

Why MVI, what makes MVI so great?

For those of you that know me, you know that previous to MVI, my favorite architecture was MVVM.

MVI is basically the same as MVVM but with added systems/features. IMO, it's essentially just an improvement on MVVM. And it doesn't make it more complex, it makes it simpler and much better for larger applications. And more specifically, larger ViewModels.

EX:
Imagine a scenario where you're sharing a single ViewModel between several fragments. Say 4 fragments just for the sake of the example. If these fragments are displaying different data, the Viewmodel would be absolutely monstrous and ugly. You'd have more Mediator and Mutable LiveData than you knew what to do with. And how do you trigger the network/cache requests in an organized way? This would be ugly.

This is where MVI comes in. It adds structure to chaotic situations like these. You leverage Kotlin Sealed classes to create "Events" that are responsible for firing off the various requests.

If I was to compare it with something, I would compare it to how android handles Intents. Like with startActivityForResult and starting intents. It's the exact same concept:
- Create an intent with a specific task in mind
- Listen for completion of the task with onActivityResult
- Handle the response from the intent.
- This is where the naming "MVI: Model View Intent" comes from. It's intent based architecture.
Instagram: https://www.instagram.com/codingwithmitch
Twitter: https://twitter.com/mitch_tabian
.
.
.

Видео Why Model-View-Intent (MVI) is My NEW Favorite Architecture канала CodingWithMitch
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
6 сентября 2019 г. 21:59:18
00:09:44
Яндекс.Метрика