Zygote
How apps work

App architecture

From the God Activity to unidirectional data flow.

7 pages77 min7 interactive10200 words
  1. 01The archaeology of app architectureEvery recommended Android architecture is a scar from a specific failure: the God Activity, the fragment lifecycle, the lost state on rotation. Reading the sequence explains why the current advice looks the way it does.intermediate11 mininteractive
  2. 02UI state and eventsA screen has exactly one state object and two directions of data. Getting that shape right removes most of the bugs that look like lifecycle problems.intermediate11 mininteractive
  3. 03Data and domain layersA repository is a policy, not a wrapper. It decides which source of truth wins, when to cache, and what a failure means — and that decision is why the data layer exists at all.intermediate11 mininteractive
  4. 04Dependency injectionDependency injection is not a library. It is the decision to pass collaborators in rather than construct them — and Android's component lifecycle is why that decision needs help.intermediate11 mininteractive
  5. 05NavigationNavigation is a data structure, not a set of activity transitions. Once it is a graph, deep links, back behaviour and state restoration become properties instead of features.intermediate11 mininteractive
  6. 06ModularizationA Gradle module is not a folder. It is a boundary the compiler enforces, a unit the build can parallelise, and a contract that a team can own.nerd11 mininteractive
  7. 07TestingThe test pyramid on Android is decided by one constraint the other platforms do not have: the device is slow and the framework is not mockable. Architecture exists, in part, to move tests up the pyramid.intermediate11 mininteractive

Test yourself

Test yourself: App architecture

1 / 8

Which is the strongest reason to add a domain layer?

0 answered · 0 correct