MVVM (Model-View-ViewModel) tách UI logic khỏi business logic: Model chứa dữ liệu và business rule, View hiển thị UI (Activity/Fragment/Composable), ViewModel chứa UI state và logic, tồn tại qua configuration change.
- ViewModel expose LiveData/StateFlow để View observe.
- Sự tách biệt này cải thiện khả năng test (test ViewModel không cần UI), tái sử dụng, và bảo trì.
- Hầu hết app Android ngày nay đều dùng MVVM.