Le app Android traggono beneficio da pattern architetturali che separano le responsabilità e migliorano la manutenibilità e la testabilità — in particolare MVVM (Model-View-ViewModel, raccomandazione di Google), MVI (Model-View-Intent) e Clean Architecture. Comprenderli è importante per costruire app ben strutturate.
MVVM — Model-View-ViewModel (consigliato)
MVVM separates the UI from logic and data:
VIEW (Activity/Fragment/Compose) → displays UI, observes the ViewModel, forwards events
VIEWMODEL → holds UI state + logic; exposes observable state (LiveData/StateFlow);
survives config changes; NO Android framework/UI dependencies (testable)
MODEL → data (repositories, data sources)
→ The View observes the ViewModel's state and updates reactively. Google's recommended
pattern (using Architecture Components).
