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
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
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
MVVM / MVI Repository Pattern with HiltMVC vs MVP vs MVVM vs MVI - Marcin MoskałaFlutter vs Native Android / iOS (WHICH DO I LEARN?!)Сергей Рябов — Как приготовить хорошо прожаренный MVI под AndroidBuild a modular Android app architecture (Google I/O'19)Kotlin Coroutines Beginner Example (Android)Simple MVI: A LiveData Based MVI Approach - Dan Lowe & Dustin SummersModel View View-Model (MVVM): Getting StartedKotlin Coroutine Jobs (Beginner Example)2 Key Concepts of Clean Architecture (VLOG)Kotlin Sealed Classes & Custom State Managment (VLog)Kotlin Singleton Example with MVVM and CoroutinesKnow about LiveData, MutableLiveData & MediatorLiveDataHilt ViewModels and Dependency InjectionDroidcon NYC 2016 - A Journey Through MV Wonderland (updated)Testing on Android Explained (Unit, Instrumentation, UI)Android Jetpack: Improve your app's architectureRecyclerView Performance with DiffUtil (Kotlin)What is Model View Controller AKA MVC 🖥BADG: Making Android reactive apps with MVI