What is MVVM and why is it used in mobile apps?
What the interviewer wants to hear
- Model: data and business logic
- View: UI that displays state and sends user events
- ViewModel: holds UI state and handles events, no direct UI references
- Easier testing and separation of concerns
- Works well with reactive state like StateFlow or Observable
Model answer
MVVM stands for Model, View and ViewModel. The Model is the data layer, such as repositories that talk to the network and local database. The View is the UI, a Compose screen or SwiftUI view, which only displays state and forwards user actions. The ViewModel sits in between: it holds the screen state, handles events like button taps, calls the repository, and exposes the result as observable state, such as a StateFlow or an @Observable object. The ViewModel never holds a reference to the View. This separation keeps UI code simple, makes business logic easy to unit test without a device, and on Android the ViewModel also survives rotation. Many teams combine it with unidirectional data flow, where state goes down and events go up.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Mobile App Developer questions
- What is the difference between native and cross-platform mobile development? When would you choose each?
- Explain the lifecycle of a mobile app screen. Why does it matter?
- How do you handle network calls and errors in a mobile app?
- How do push notifications work in a mobile app?
- How do you run slow work like network calls or database reads in a mobile app without freezing the UI?
- What options do you have for storing data on the device, and how do you choose between them?
- How do you request runtime permissions like camera or location, and what do you do when the user says no?
- How do you make your app look good on different screen sizes, orientations and font sizes?
- What is the difference between declarative UI (Compose, SwiftUI, Flutter, React Native) and the older imperative style?