← Android Interview Prep: Kotlin, Coroutines & Flow

Explaining your architecture in five minutes

Lesson 5 of 52 min read

A script for the "walk me through your app" question, plus the follow-ups.

"Walk me through the architecture of your app" is asked in almost every mid and senior round, and it is where unprepared candidates ramble for ten minutes. Use a fixed path.

The five-minute path

  1. One sentence of context. What the app does and its scale. "A grocery app, about 2 million monthly users, 40 screens."
  2. The layers, named with their job. UI renders state. ViewModel holds state and handles events. Repository decides where data comes from. Data sources are Retrofit and Room.
  3. One data flow, end to end. Pick a real screen and follow one tap through all the layers.
  4. One trade-off you made. "We kept XML on the checkout screen because it is our highest-revenue flow and we did not want a rewrite there."
  5. What you would change. Honest, specific, small.

The example to have ready

"The user pulls to refresh. The UI sends an event to the ViewModel, which calls repository.refresh(). The repository hits the API, maps DTOs to domain models and writes them to Room. The UI is collecting a Room Flow, so it updates itself — the network result never goes straight to the screen. That is why the app opens with content when the user is offline."

That paragraph answers offline support, single source of truth, mapping and unidirectional data flow at once, without using any of those phrases as a buzzword.

The follow-ups, and short answers

  • "Why a use-case layer, or why not?" Use cases pay off when the same logic is used by several ViewModels or has real rules to test. For a pass-through call they are ceremony — say which situation you are in.
  • "How do you test this?" ViewModel tests with a fake repository, repository tests with in-memory Room and MockWebServer, and two or three UI tests on the revenue path.
  • "How do you handle errors?" A sealed result type at the repository boundary, so the ViewModel does a when and the UI shows a human sentence.
  • "Multi-module?" Say the reason, not the fashion: build times and ownership boundaries. If the app is small, say that one module is the right call — that answer is respected.