Estimation and technical decisions
Why it matters
- An optimistic single-number estimate for a Jetpack Compose migration or a Room schema change can push a release and cost the team the PM's trust in future plans.
- Technical choices like the navigation approach, DI framework or database compound over time: an expensive-to-reverse decision can cost months to undo, while a cheap-to-reverse one costs an afternoon.
- Interviewers at senior and staff level probe how you handle uncertainty, not just how you write
ViewModelor composable code. They want to hear you name unknowns, give ranges and explain trade-offs. - Estimation and decision-making are where a senior Android engineer earns trust beyond their own code: other people plan around your numbers and live with your choices.
The simple explanation
- Planning a road trip: you do not say "I will arrive in exactly 4 hours." You say "3 to 5 hours, depending on traffic and whether the bridge is open."
- If you do not know whether the bridge is open, you spend ten minutes checking (a spike) instead of guessing.
- Choosing where to stop for lunch is a two-way door: easy to change. Choosing which side of the lake to drive around is closer to a one-way door: turning back costs a lot.
- A good driver plans the route, names the risks and still adjusts at the next exit.
How do you estimate Android work? Break the work into small sub-tasks, give each one a range instead of a single number, call out what you do not know, and turn the biggest unknowns into short spikes before committing. For example, "How long to add a lastSyncedAt column and rename title to name in our Room database?" is not "2 days". It is: add the column with an AutoMigration, write an AutoMigrationSpec with @RenameColumn, backfill existing rows, test every upgrade path with MigrationTestHelper, update DAO queries and mappers. Each gets a range, and the answer is "about 6.5 to 8.5 days, mostly driven by the backfill" (the Playground below works it out).
Three-point estimates. For each sub-task give an optimistic (O), most likely (M) and pessimistic (P) value. A common weighting from PERT is expected = (O + 4M + P) / 6, with a spread of roughly (P − O) / 6. Add the expected values to get the total. Adding every O and every P gives the widest possible range; it is a safe bound, but every task going perfectly (or badly) at once is unlikely, so quote something narrower and say what would push you to the edges.
Spikes reduce uncertainty before you commit. A spike is a time-boxed investigation (often a day or two) with one question and a concrete deliverable: a prototype, a measurement or a written answer. Android examples: can our custom chart View be hosted in Compose with AndroidView without breaking touch handling; how long does a migration take on a database the size of our largest users'; does an expect/actual split compile for every KMP target we ship.
Technical decisions need a trade-off table and a reversibility label. Jeff Bezos's "one-way door / two-way door" framing (from Amazon's shareholder letters) is a useful shorthand.
| Question | Two-way door (cheap to reverse) | One-way door (expensive to reverse) |
|---|---|---|
| Speed of decision | Fast; the engineer or pair decides | Slower; gather input, write it down |
| Example | A new detekt rule, a library for one screen | Database and sync model, app-wide navigation approach |
| Cost of being wrong | Hours to days | Weeks or months of migration |
| Who decides | The people doing the work | The team, with the tech lead and affected owners |
For two-way doors, decide quickly and move on. For one-way doors, slow down: compare at least two options in a table, name the unknowns, run a spike if one would change the answer, and record the decision (an ADR, covered in the design-docs lesson) so it is not re-argued without new information.
Call out unknowns explicitly. "We have never run a migration on a 200 MB user database" is a better estimate input than a silent assumption. Unknowns become spikes or explicit risks, not hidden padding.
Notes
- Give a range ("6 to 9 days"), not a single number, and say what would move it. A point estimate hides uncertainty and becomes a promise.
- Break work into sub-tasks of a day or two at most. A sub-task you cannot estimate is a sign you need to split it further or spike it.
- Three-point estimate per sub-task: expected = (O + 4M + P) / 6 is a common PERT weighting. Sum the expected values; do not quote the sum of all worst cases as the plan.
- The sum of every best case to every worst case is the outer bound, not the likely range. Use it to show risk, not as the estimate.
- A spike is time-boxed, answers one question and produces a concrete artefact: a prototype, a measurement or a written answer. It is not open-ended research.
- Label technical choices by reversibility. Two-way doors (a lint rule, a library used in one screen) should be decided fast. One-way doors (database, sync model, navigation approach) need a trade-off table and broader input.
- A trade-off table lists options, pros, cons, cost of being wrong and reversibility. It forces a comparison of at least two options and makes the reasoning visible.
- Keep a simple log of estimates vs. actuals per sub-task and review it now and then. It shows which kinds of work your team consistently underestimates, such as Room migrations or deep-link testing.
- Re-estimate when you learn something. Telling the PM early that the backfill is harder than expected is part of estimating, not a failure of it.
- In interviews, a senior answer names the unknowns, proposes a spike, gives a range and explains how the decision will be revisited.
Code example
A lightweight decision record for an Android navigation change, as JSON a team could keep next to an ADR or paste into a ticket. It captures context, two options, reversibility, unknowns and a spike plan.
{
"decision": "How to add Compose screens to a Fragment-based app",
"context": "Navigation uses the Fragment-based Navigation component with Safe Args; all new screens will be written in Compose.",
"options": [
{
"name": "Keep Fragment navigation; host each new Compose screen in a Fragment with ComposeView",
"pros": ["No change to the existing graph or deep links", "Screens can move one at a time"],
"cons": ["A Fragment wrapper per screen", "Two UI toolkits for a while"],
"reversible": true
},
{
"name": "Move the whole app to Navigation Compose with type-safe routes now",
"pros": ["One navigation graph in Compose", "No Fragment wrappers"],
"cons": ["Every existing screen and deep link changes at once", "Blocks feature work during the move"],
"reversible": false
}
],
"chosen": "Keep Fragment navigation with ComposeView",
"rationale": "Cheap to reverse and does not block features; revisit when most screens are Compose",
"unknowns": [
"Does our custom chart View work inside Compose via AndroidView?",
"Which deep links from partner apps must keep working unchanged?"
],
"spike": "1 day: one Compose screen hosted in a Fragment, including the chart, opened from a deep link",
"review_after": "Spike result, before next planning"
}- Hosting Compose in existing Fragments with
ComposeViewis the incremental path Google's Compose interop guidance describes, so it is a reasonable default for the reversible option. reversibleis set per option. Asking "can we undo this?" for each option is what separates a quick decision from a slow one.unknownsis a list, and thespikeanswers the riskiest one with a concrete deliverable, not "investigate navigation".
Run the idea in plain Kotlin
A three-point estimate for a Room migration from schema version 3 to 4. It prints the expected value per sub-task, the outer bounds and a likely range for the total, and names the riskiest sub-task (the one with the widest spread), which is the best candidate for a spike.
import kotlin.math.round
import kotlin.math.sqrt
data class SubTask(val name: String, val optimistic: Double, val likely: Double, val pessimistic: Double) {
val expected: Double get() = (optimistic + 4 * likely + pessimistic) / 6
val sd: Double get() = (pessimistic - optimistic) / 6
}
fun r1(x: Double): Double = round(x * 10) / 10
fun main() {
// Room migration from schema version 3 to 4, estimates in days
val tasks = listOf(
SubTask("Add column + AutoMigration(3, 4)", 0.5, 1.0, 2.0),
SubTask("Rename column with a @RenameColumn spec", 0.5, 1.0, 3.5),
SubTask("Backfill old rows in onPostMigrate", 1.0, 2.0, 5.0),
SubTask("MigrationTestHelper tests for 1->4, 2->4, 3->4", 1.0, 1.5, 3.0),
SubTask("Update DAO queries and repository mapping", 0.5, 1.0, 2.0)
)
for (t in tasks) {
println(t.name + ": " + t.optimistic + " / " + t.likely + " / " + t.pessimistic + " -> expected " + r1(t.expected))
}
val best = tasks.sumOf { it.optimistic }
val worst = tasks.sumOf { it.pessimistic }
val expected = tasks.sumOf { it.expected }
val sd = sqrt(tasks.sumOf { it.sd * it.sd }) // assumes the tasks vary independently
println("Every best case: " + best + " days, every worst case: " + worst + " days")
println("Expected: " + r1(expected) + " days")
println("Likely range (expected +/- 1 sd): " + r1(expected - sd) + " to " + r1(expected + sd) + " days")
println("Biggest risk: " + tasks.maxBy { it.sd }.name)
}Expected output:
Add column + AutoMigration(3, 4): 0.5 / 1.0 / 2.0 -> expected 1.1
Rename column with a @RenameColumn spec: 0.5 / 1.0 / 3.5 -> expected 1.3
Backfill old rows in onPostMigrate: 1.0 / 2.0 / 5.0 -> expected 2.3
MigrationTestHelper tests for 1->4, 2->4, 3->4: 1.0 / 1.5 / 3.0 -> expected 1.7
Update DAO queries and repository mapping: 0.5 / 1.0 / 2.0 -> expected 1.1
Every best case: 3.5 days, every worst case: 15.5 days
Expected: 7.5 days
Likely range (expected +/- 1 sd): 6.5 to 8.5 days
Biggest risk: Backfill old rows in onPostMigrate
- The combined spread assumes the sub-tasks vary independently. In real projects they often go wrong together (one surprise in the schema affects several tasks), so treat the likely range as a guide and keep the outer bounds in view.
- You would tell the PM "about 6.5 to 8.5 days, and the backfill is the risk; I can narrow it with a one-day spike on a copy of a large user database."
In production
- A team estimated migrating a handful of XML screens to Jetpack Compose from its experience with simple list screens, and gave the PM one number.
- Two screens relied on custom
Viewsubclasses with their own drawing and touch handling; nobody had tried hosting them withAndroidView. - Deep links into those screens also needed rework, which no sub-task covered. The migration ran well past the estimate and the PM stopped trusting the team's numbers for a while.
- Before re-estimating, the team ran a one-day spike that hosted one custom view with
AndroidViewand checked touch handling and state restoration. - They split the rest into per-screen sub-tasks with three-point estimates, and made deep-link testing its own sub-task.
- They now give the PM a range and the main risk with every estimate, and log estimate vs. actual per sub-task to see which kinds of work they underestimate.
- Early in a project, a team adopted a small third-party navigation library because it was quick to set up.
- Later the library stopped being maintained and lagged behind the Compose and AndroidX versions the team needed.
- Its types were referenced directly from every screen across several modules, so replacing it took a long, disruptive migration.
- In hindsight the choice was a one-way door: anything referenced from every screen is expensive to remove, however small the library.
- During the migration to Navigation Compose, screens were changed to expose plain callbacks (such as
onOpenDetail(id)) and only the navigation host knows about routes, so screens no longer depend on the navigation library at all. - The team added one question to dependency reviews: "If this library disappeared, how many files would we touch?" A large answer means a trade-off table and a second reviewer.
Common mistakes
- Giving a single-point estimate. "4 days" sounds like a promise. When reality differs, it looks like failure. Give a range, name the main risk and say what would change the number.
- Quoting the worst-case sum as the plan, or the best-case sum as the promise. The sum of every best case is almost never achieved, and the sum of every worst case pads the plan heavily. Sum the expected values and show the outer bounds as risk.
- Treating a spike as open-ended research. Without a time-box and a deliverable, a spike drifts for a week. Set a limit and a concrete output: a prototype, a measurement or a written answer.
- Deciding a one-way door in a five-minute chat. Choosing the database, sync model or app-wide navigation approach in passing skips the trade-off analysis. Write down at least two options and what being wrong would cost.
- Hiding unknowns inside padding. Quietly doubling an estimate hides the risk from the people who could reduce it. Name the unknown ("we have never migrated this table on a large database") and propose a spike.
- Never re-estimating. An estimate made before the spike is a guess. Update it when you learn something and tell the PM early.
Interview questions
Answer out loud first. Then reveal the answer and compare it at each depth.
“How do you estimate a task you have never done before in an Android project?”
“Walk me through how you decide between two technical options for an Android app.”
“Tell me about a time your estimate was wrong. What did you do?”
“How do you make a technical decision when you do not have all the information?”
Quiz
You are asked to estimate migrating six XML screens to Jetpack Compose. What is the best first step?
Which of these is closest to a one-way door (expensive to reverse) in an Android app?
What best describes a spike?
Five sub-tasks are each estimated at 2 days optimistic, 3 days most likely and 4 days pessimistic. What is the most accurate way to report the total?
0 of 4 answered
Mini task
15-minute exercise: estimate and decide
-
Pick a real or hypothetical Android task, for example "add a column and rename another in our Room database" or "migrate one screen from XML to Compose".
-
Break it into four to six sub-tasks of a day or two at most. Write each on its own line.
-
Give each sub-task an optimistic, most likely and pessimistic value. Compute the expected value with (O + 4M + P) / 6, add them up, and note the sum of all optimistic and all pessimistic values as the outer bounds. You can paste your numbers into the Playground above.
-
List two or three unknowns. For each, write whether it needs a spike and what the spike would deliver (a prototype, a measurement, a written answer).
-
Pick one technical choice in the task (for example
AutoMigrationwith a spec vs. a hand-writtenMigration, or Hilt vs. manual DI for one module). Build a two-option trade-off table: option, pros, cons, cost of being wrong, reversible (yes or no). -
Mark the chosen option and write one sentence of rationale. If it is a one-way door, note who else should review it.
Done when: you have one page with sub-tasks, three-point estimates, an expected total and outer bounds, a list of unknowns with spike plans, and a trade-off table with a chosen option and rationale. Explain it to a colleague in two minutes.