/Learn
Mobile systems at scale · Part 7 of 7

The principal engineer interview, mobile edition

Panel scoring for mobile system design: what they look for, how to structure forty-five minutes, and how decision stories read as principal level.

07
InterviewingLeadership

Mobile engineeringAll mobile pages

You have the systems. This post shows how a panel scores them, and how to tell your own decisions as stories. Start from the basics in Day 14 →

Study with AI

If you only read this

  1. Spend the first five minutes on questions and numbers. Draw only after you know what you are drawing.
  2. Go deep on one hard thing with a real mechanism, not five things at the surface.
  3. Every decision comes with what you rejected, what it cost and how you would know it was wrong.
The one ruleA principal answer names the problem behind the problem, makes the trade-off explicit and talks about people and rollout, not only boxes.

01What the panel is actually scoring

SignalWhat it sounds likeWhat loses it
ScopingAsks about users, scale, offline needs, compliance. States assumptions.Starts drawing in the first minute.
Judgement'I chose X over Y because Z, and I would revisit if W.'Lists technologies without choosing.
DepthExplains the mechanism: how the cursor is advanced, what the 409 contains.Stays at buzzword level.
OperabilityFailure modes, monitoring, rollout, kill switches.Only the happy path.
LeadershipTeam shape, sequencing, who owns what, how to migrate.Designs as if alone.
CommunicationClear structure, checks in, adapts to hints.Monologue, or defensiveness when challenged.

02Forty-five minutes, minute by minute

MinutesDoSay
0–5Clarify and estimate'Before I draw, can I check a few things about users and scale?'
5–15High-level architecture'Three parts: the device, the sync service and object storage. Here is how data moves.'
15–30Deep dive on the hardest part'The risky bit is conflicts. Let me go through the mechanism.'
30–40Trade-offs, failures, rollout'What breaks first is... we would know because... and we degrade by...'
40–45Team and evolution'I would build it in three milestones with these owners.'
Practise itEach round in the Interview room has the same shape, a timer, practice mode and a whiteboard. Run one every day for a week and speak out loud.

03Decision stories

Panels at this level always ask about something you did. A strong story has five parts, told in about two minutes: the situation and what was at stake; the options you considered; the decision and who you had to convince; the result with numbers; and what you would change.

Prepare six stories you can bend to different questions. Good raw material, for a mobile principal: a sync or offline redesign, a major performance or crash-rate improvement, a build or release pipeline overhaul, a migration that ran without a big bang, a production incident you led, and a time you disagreed with a senior colleague and either changed your mind or theirs.

A story skeleton you can fill in

story-skeleton-you.txtPlain text
1Situation   : 4M users, crash-free sessions 98.1%, 30% of crashes in sync on Android 10-11.2Options     : (a) patch the worker, (b) move sync into a native engine with an outbox, (c) buy a sync SDK.3Decision    : (b). Convinced the PM with a two-week spike: crash rate in spike -70%.4Cost        : 3 engineers, 2 quarters; froze two features.5Result      : crash-free 99.6%, support tickets about lost data -85%, release cycle 2w -> 1w.6Regret      : under-invested in migration tooling; the first 5% rollout needed a hotfix.
6 linesUTF-8Plain text

04Telling the difference between senior and principal

DimensionSeniorPrincipal
ScopeSolves the feature wellChanges how several teams build
Trade-offsKnows the optionsShows what each costs the organisation, not just the code
RiskHandles failure casesDesigns the rollout, the kill switch and the measure of success
InfluencePersuades the teamAligns product, platform and leadership with evidence
Time horizonThis releaseTwo years, including how the design can be removed

05Mistakes that cost offers

  • Naming five databases and no reason to choose between them.
  • Designing the server in detail and skipping the phone, in a mobile interview.
  • Never mentioning data loss, privacy, battery or the OS killing the app.
  • Arguing instead of exploring when the interviewer pushes back. A hint is an invitation to show how you think.
  • Saying 'we' for everything. Be precise about what you decided and what you built.
  • No numbers. Even rough ones show the design is grounded.

06A one-week plan

  • Day 1: Offline field app round. Draw it twice from memory.
  • Day 2: Chat and Feed rounds. Focus on ordering and paging.
  • Day 3: Payments and Booking. Focus on idempotency and holds.
  • Day 4: Release platform round and your six decision stories.
  • Day 5: An AI round (assistant or RAG) with the AI deep dives.
  • Day 6: Revise the critical Q&A and fix your weakest section.
  • Day 7: A full mock with a friend, a timer and the whiteboard.

07Tested code, explained

The contract between phone and server

Write this on the board early. These few types decide how the whole system behaves when things fail.

SyncEngine.ktKotlin
1sealed interface OpResult {2  val opId: String3  data class Applied(override val opId: String, val seq: Long) : OpResult4  data class Conflict(override val opId: String, val theirs: Theirs) : OpResult5  data class Rejected(override val opId: String, val reason: String) : OpResult6}7 8/** One line of the server's change log. */9data class Change(val seq: Long, val jobId: String, val field: String, val value: String, val version: Int)10data class PullPage(val changes: List<Change>, val next: Long, val hasMore: Boolean)11 12/** 429 or 5xx, or no network at all. Keep the ops and try again later. */13class TryLater(val afterMs: Long? = null) : IOException("try later")14 15/** 410: this device's cursor is older than the log keeps. */16class CursorTooOld(val snapshotUrl: String) : IOException("cursor too old")17 18interface SyncApi {19  suspend fun push(ops: List<Op>): List<OpResult>20  suspend fun pull(cursor: Long, limit: Int): PullPage21}
21 linesUTF-8Kotlin
OpResult
Three answers per op: applied, conflict or rejected. One batch can contain all three.
val seq: Long
The line number in the server's log. The cursor is simply the last number the phone has read.
TryLater
429, 5xx or no network. A separate type means retry code can't confuse this with a bad request.
CursorTooOld
The server's 410. The phone must rebuild from a snapshot, because some deletes may be gone from the log.

Compiled and tested by npm run test:mobile.

Priya's whole day, as a program

This runs the real engine against the real server code. The numbers in the story are what this function produces, and a test checks them.

PriyasDay.ktKotlin
1data class StoryResult(2  val firstRun: RunOutcome,3  val cursorAfterRun: Long,4  val ticks: Int,5  val amber: Int,6  val theirs: Theirs?,7  val writesBeforeRetry: Int,8  val writesAfterRetry: Int,9  val finalVersion: Int,10  val tabletSees: String?,11)12 13/** Priya's whole day, running against the real engine and the real server code. */14suspend fun priyasDay(): StoryResult {15  val server = SyncServer(startSeq = 88411)16  val jobIds = List(12) { "j-${73 + it}" }              // twelve jobs, including j-81 and j-8417  jobIds.forEach { server.seedJob(it, version = 4) }18 19  fun phone(prefix: String): Pair<LocalDb, JobRepository> {20    val db = LocalDb(cursor = 88411)21    db.transaction { jobs = jobIds.associateWith { Job(it, version = 4) } }22    var n = 023    return db to JobRepository(db, { "$prefix-${++n}" }, by = prefix)24  }25 26  val (priya, priyaRepo) = phone("priya")27  val (tablet, devRepo) = phone("dev")28  val priyaSync = SyncEngine(priya, server)29  val devSync = SyncEngine(tablet, server)30 31  // 2:40 pm, underground. 37 edits, with no network involved at all.32  priyaRepo.setAnswer("j-84", "valve_3", "leaking")33  priyaRepo.setAnswer("j-81", "valve_3", "leaking")34  var edits = 235  outer@ for (q in 1..4) for (job in jobIds - "j-84") {   // the other eleven jobs get the rest36    if (edits == 37) break@outer37    priyaRepo.setAnswer(job, "q$q", "ok")38    edits += 139  }40 41  // 3:30 pm, in the office. Dev changes one field she also changed, and one she did not.42  devRepo.setAnswer("j-84", "valve_3", "replaced")43  devRepo.setAnswer("j-81", "instructions", "Use the east stairs")44  devSync.run()45 46  // Everyone else's work during those hours: 102 more changes in the log.47  val others = List(102) { Op("other-$it", "j-other", "q$it", "ok", baseVersion = 0) }48  server.push(others)49 50  // 4:12 pm. Signal returns and the worker runs.51  val firstRun = priyaSync.run()52  val rows = jobIds.map { priya.jobs.value.getValue(it) }53  val ticks = rows.count { it.syncState == SyncState.SYNCED }54  val amber = rows.count { it.syncState == SyncState.CONFLICT }55  val theirs = priya.jobs.value.getValue("j-84").theirs56 57  // A lost reply: the same ops arrive again, and nothing is written twice.58  val writesBeforeRetry = server.writes59  val sentAgain = List(12) { i -> Op("priya-${i + 2}", "j-81", "q", "ok", 4) }60  server.push(sentAgain)61  val writesAfterRetry = server.writes62  val cursorAfterRun = priya.cursor63 64  // 4:14 pm. She looks at both values and keeps her own.65  priyaRepo.resolve("j-84", "leaking")66  priyaSync.run()67 68  // 4:15 pm. The push told Dev's tablet to look, so it pulls after its own cursor.69  devSync.run()70 71  return StoryResult(72    firstRun, cursorAfterRun, ticks, amber, theirs, writesBeforeRetry, writesAfterRetry,73    finalVersion = priya.jobs.value.getValue("j-84").version,74    tabletSees = tablet.jobs.value.getValue("j-84").answers["valve_3"],75  )76}
76 linesUTF-8Kotlin
SyncServer(startSeq = 88411)
The log starts where her cursor is, c_88411.
priyaRepo.setAnswer(...)
37 edits underground. Nothing here talks to a network.
devSync.run()
Dev's 3:30 pm edit reaches the server first, which sets up the conflict.
server.push(others)
102 changes from other people, which brings the pull to 140.
priyaSync.run()
The 4:12 pm run. A test asserts 36 applied, 1 conflict, 140 pulled and cursor c_88551.
priyaRepo.resolve(...)
Her choice is a new edit based on version 5, and it reaches version 6.

Compiled and tested by npm run test:mobile.

08Interview questions

You have 45 minutes and the prompt is 'design WhatsApp'. What are your first two minutes?
Clarify scope (one-to-one, groups, media, multi-device, end-to-end encryption), scale (users, messages per second) and non-functional goals (delivery guarantees, offline). Then state assumptions and propose the order you will cover things.
The interviewer says your design is over-engineered. What do you do?
Ask what they would cut and why, check the requirement it was serving, and offer a simpler version with the exact conditions under which you would grow into the complex one.
Tell me about a design decision you got wrong.
Describe the context, why the decision was reasonable then, how you detected the problem, what it cost and what process change followed. Ownership without drama.
How do you show leadership in a system design round?
Sequence the work into milestones, name owners and interfaces, say how you would de-risk the hardest part first, and describe how the team would know it works.

Practise it:

InterviewingLeadership
Written by

Rizvan

Builds mobile and AI systems at scale and writes the series he wished existed before his own principal loop: one rule, one analogy, something to break, and the interview kit.

All 7 parts
AI Engineer · written by Rizvan · part 7 of 7