Composing ViewModels: Breaking ViewModels into smaller self-contained UI models
summary
A new architecture called microfeatures breaks monolithic ViewModels into host-agnostic UI models plus composables, wired by factory APIs and Dagger and exposing StateFlow and one-time actions; teams keep only one Jetpack ViewModel at the home root while composing many platform-independent UI models, enabling eight teams to share a single home screen and reuse about 80-90% of existing domain code. Implementations use composable factory lambdas, favor Kotlin Multiplatform compatibility, and plan codegen to reduce factory boilerplate.
AI-written summary · about
chapters (16)
- 0:00Introduction to talk
- 3:16New UI design challenge
- 8:55Paradigm shift to micro features
- 10:18What is a micro feature
- 13:29UI model vs ViewModel
- 15:37Unidirectional data flow in micro features
- 17:27Micro feature blueprint
- 19:36Implementing a micro feature
- 25:14Hosts and composition
- 27:03Home screen composition
- 29:09Integrating composables in hosts
- 31:40Composition tree overview
- 32:03When to use micro features
- 33:07Pitfalls of micro features
- 34:11Future possibilities
- 38:48Conclusion and next steps
related talks
40mComposing ViewModels:Breaking ViewModels into smaller self-contained UI models
41mBreaking ViewModels into smaller self-contained UI models
35mBreaking Up with Big ViewModels
43mHelp! ViewModel
29mModern Android Development using MVI architecture
34mArchitectures in the Compose World
38mArchitecture Agnostic UI Development
22mBloated ViewModels? What Next
