~/talk

Breaking Up with Big ViewModels

Talkat droidcon Berlin 2025 · 2025-09-24..09-26· [android, frontend-architecture]
slides:none on file

Breaks a 1,376-line ViewModel into multiple, screen-scoped ViewModels backed by a shared Mediator that holds only transient UI state; a gallery example uses three ViewModels (grid, top bar, bottom bar) and shows selection updates flowing via the Mediator, not direct VM-to-VM calls. Uses Jetpack Compose, Hilt or Koin scoping for one mediator per navigation destination, tests with Kotest behavior specs, and enforces the pattern with lint-as-tests via Consist (and Harmonize for iOS). Mediator pattern 1,376-line ViewModel

AI-written summary · about

  1. 0:00Introduction
  2. 8:06Why ViewModels become too large
  3. 13:24Mediator pattern
  4. 20:28Implementing mediators
  5. 25:48Testing ViewModels
  6. 30:43Lint rules enforcement
  7. 33:51Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.