Leadership cheat sheet

Revise Android tech leadership: tagged code review comments, ADRs, PERT estimates, trade-off tables, and mentoring juniors with growth plans.

Key ideas

  1. Review the change, not the person; phrase every comment about the code, not the author.
  2. Tag comments as blocking:, nit:, question:, or praise: so the author knows what must change and what is optional.
  3. Always explain why: "use viewModelScope because it cancels with the ViewModel lifecycle" teaches; a bare instruction does not.
  4. Automate style with ktlint and detekt in CI so human reviewers focus on logic, state flow, and Compose correctness.
  5. Keep PRs small and focused; split a mixed Compose screen, ViewModel, and Repository change into separate PRs.
  6. One decision per ADR, numbered sequentially and never renumbered; supersede old ADRs, never rewrite them in place.
  7. Give estimation ranges with three-point PERT (O + 4M + P) / 6; label decisions by reversibility (two-way vs one-way doors).
  8. Growth plans name a real module, a deadline, and a concrete output; revisit every 30-day check-in and adjust if a milestone is missed.

APIs at a glance

API or termUse it for
ktlintRun in CI to enforce Kotlin style; removes formatting and import-order nits from human review
detektRun in CI for static analysis; catches naming and complexity issues before a human sees the diff
viewModelScopeCoroutine scope that cancels with the ViewModel lifecycle; prefer over GlobalScope
StateFlow / MutableStateFlowExpose a read-only StateFlow from the ViewModel; keep MutableStateFlow private
collectAsStateWithLifecycle()Collect StateFlow in Compose screens per the PR checklist
ComposeViewHost a Compose screen inside an existing Fragment during a gradual migration
remember(key1, key2)Store state in Compose; pass every input as a key to avoid stale remembered values
LaunchedEffect / DisposableEffectRun side effects in Compose; switch to DisposableEffect when the effect needs cleanup
HiltDependency injection; a common ADR topic alongside Koin and manual DI
@OptInMark deliberate use of an experimental API; mention it in the PR description

Snippets

Scaffold a new ADR (bash)

#!/usr/bin/env bash
TITLE="${1:?Usage: $0 \"Decision title\"}"
ADR_DIR="docs/adr"; mkdir -p "$ADR_DIR"
LAST=0
for f in "$ADR_DIR"/[0-9][0-9][0-9][0-9]-*.md; do
  [ -e "$f" ] || continue
  n=$(basename "$f" | cut -c1-4)
  n=$((10#$n))
  if [ "$n" -gt "$LAST" ]; then LAST=$n; fi
done
NEXT=$(printf "%04d" $((LAST + 1)))
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-//; s/-$//')
FILE="$ADR_DIR/${NEXT}-${SLUG}.md"
cat > "$FILE" <<EOF
# ${NEXT}. ${TITLE}
 
Status: Proposed
 
## Context
 
## Decision
 
## Consequences
EOF
echo "Created $FILE"

PR checklist – before you open the PR

{
  "sections": [
    {
      "name": "Before you open the PR",
      "items": [
        "Diff is small and focused (split if large)",
        "ktlint and detekt pass locally",
        "No TODO or FIXME without a linked issue",
        "Any @OptIn to an experimental API is deliberate"
      ]
    }
  ]
}

Trade-off table – Compose in a Fragment app

{
  "decision": "Add Compose screens to a Fragment-based app",
  "options": [
    {
      "name": "Host each Compose screen in a Fragment with ComposeView",
      "pros": ["No change to existing graph or deep links"],
      "cons": ["Fragment wrapper per screen", "Two UI toolkits"],
      "reversible": true
    }
  ],
  "spike": "1 day: one Compose screen in a Fragment, opened from a deep link"
}

Rules of thumb

  • Prefer small, focused PRs; split a mixed Compose screen, ViewModel, and Repository change into separate PRs.
  • Always explain why in a review comment: name the rule, not just the instruction.
  • Never rewrite an old ADR in place; write a new one and set the old status to "Superseded by ADR-000N."
  • Give a range, not a single number, for any estimate; name the risk that moves it.
  • Never correct a junior in standup or a team channel; raise it in a 1:1 or as a code-focused PR comment.
  • Prefer a time-boxed spike with a concrete artefact over open-ended research.

Gotchas

  • Reviewing the person instead of the code. Writing "you always forget null checks" attacks the author and shuts down conversation; describe the code path instead, e.g. "this path skips the null check on the API response."
  • No blocking/nit separation in review comments. If every comment looks the same the author cannot tell which ones block merge; tag with blocking: or nit: so the priority is clear.
  • Giving a single-point estimate. "4 days" sounds like a promise and looks like failure when reality differs; give a range like "6 to 9 days" and name the main risk.
  • Rewriting an old ADR in place. You lose the reasoning that was true at the time; write a new ADR and mark the old one "Superseded by ADR-000N" so only the status line changes.
  • Mentoring by solving the problem for the junior. The junior never builds the skill and you become a bottleneck; ask "what do you think the next step is?" and let them try, even if it is wrong.
  • Public correction in standup or a team channel. It kills psychological safety and the junior stops asking questions, so the next bug ships; raise it in a 1:1 or as a code-focused PR comment.

Quick interview answers

How do you structure a code review to teach the author?

I tag every comment as blocking:, nit:, question:, or praise: so the author knows what must change and what is optional. I always explain why, for example "use viewModelScope because it cancels with the ViewModel lifecycle," instead of a bare instruction.

What is an ADR and how do you handle a decision that changes?

An ADR follows Nygard's format with Title, Status, Context, Decision, and Consequences, one decision per file numbered sequentially. When a decision changes I write a new ADR and set the old one's status to "Superseded by ADR-000N"; I never rewrite the old file.

How do you estimate a feature for a PM?

I break the work into sub-tasks of a day or two, apply a three-point PERT estimate (O + 4M + P) / 6 per sub-task, and give a range like "6 to 9 days" with the main risk named. I re-estimate after any spike and tell the PM early if the number moves.

How do you mentor a junior Android developer?

I set a growth plan with a named module, a 30/60/90-day horizon, and a concrete output like a design doc or a PR the junior leads. I pair on hard parts like ViewModel state or a Room migration, check in the same day on the first task, and never correct publicly in standup.

How do you decide between Compose and Views for new screens?

I treat it as a two-way door and build a trade-off table comparing options, pros, cons, and cost of being wrong. A common choice is to host new Compose screens in existing Fragments with ComposeView, keeping the navigation graph unchanged until most screens migrate.

How do you handle a disagreement with a PR author?

A review is a conversation, not a verdict; the author can push back on a nit. For blocking issues I explain the reason, not just cite a rule, and if we disagree we discuss it in a 1:1 or a short call.

Go deeper