Aplikasi Android mendapat manfaat daripada corak seni bina yang mengasingkan tanggungjawab serta meningkatkan kebolehselenggaraan dan kebolehujian — terutamanya MVVM (Model-View-ViewModel, cadangan Google), MVI (Model-View-Intent), dan Clean Architecture. Memahaminya adalah penting untuk membina aplikasi yang berstruktur baik.
MVVM — Model-View-ViewModel (disyorkan)
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).
