~/talk

Composing an API the *right* way

Talkat droidcon New York 2024 · 2024-09-19..09-20· [api-design]
slides:none on file

Summary of Jetpack Compose API guidelines: prefers UpperCamelCase for constant-like values and distinguishes composables that emit UI as noun constructors from those that return values in lowerCamel; components must emit one root node and return Unit; state should be passed as plain values or callbacks (avoid MutableState), or wrapped in a remembered stateholder via a factory; provide a Modifier parameter named modifier as the first optional param and apply it to the root; use slots and movableContentOf to move reusable UI efficiently; AndroidX docs ~13,000 words and lint rules enforce many checks.

AI-written summary · about

  1. 0:00API design in Compose
  2. 2:26Naming Compose constants
  3. 3:51Naming composables by behavior
  4. 6:15Components emit one root node
  5. 8:23Avoid state ownership in components
  6. 10:31Composition locals for globals
  7. 11:55Default arguments benefits
  8. 14:43Modifiers for customization
  9. 20:08Slots for UI parameters
  10. 25:06Parameter ordering in composables
  11. 27:56State in Compose components
  12. 30:43State holders for complex state
  13. 33:51API design across layers
  14. 34:32Additional resources & Q&A
~/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.