Slide 1

Slide 1 text

Rikin Marfatia — Android @ Pinterest — @heyrikin Preview Driven Development™ Avoid build times at all cost!

Slide 2

Slide 2 text

Agenda Compose + Previews 101 Previews —> Isolated Features Dependency Fakes Gradle Strategy for Previews Real World Example

Slide 3

Slide 3 text

Compose + Previews

Slide 4

Slide 4 text

Jetpack Compose Declarative UI @Composable functions Previews for visualization Android is fun again

Slide 5

Slide 5 text

@Previews

Slide 6

Slide 6 text

Deploy Previews to Device

Slide 7

Slide 7 text

Powerful in-IDE Support

Slide 8

Slide 8 text

Faster UI Development

Slide 9

Slide 9 text

Isolated Features

Slide 10

Slide 10 text

Isolated Features Built “isolated” from the rest of the application Simulate inputs Stub out side effects + outputs

Slide 11

Slide 11 text

Mini Apps (Sample Apps) Run each feature as an app Composition of features Setup for modularization

Slide 12

Slide 12 text

Other Benefits Feature Teams Easy Testing + Refactoring Non-engineers can play with Previews

Slide 13

Slide 13 text

Faking Dependencies

Slide 14

Slide 14 text

Control your Environment Real Application Real Application - No Internet Fake Feature

Slide 15

Slide 15 text

Real Dependencies are Expensive 💰💰💰 import InnocentDependency Retrofit OkHttp Room SqlLite KAPT

Slide 16

Slide 16 text

Interface + Implementation

Slide 17

Slide 17 text

Gradle Strategy

Slide 18

Slide 18 text

Gradle Modules — Before App Feature Common Feature Feature Network

Slide 19

Slide 19 text

Gradle Modules — After App Feature NetworkLive Common Feature Feature Network FeaturePreview FeaturePreview FeaturePreview

Slide 20

Slide 20 text

Interface + Live Modules App Feature NetworkLive Common Feature Feature Network FeaturePreview FeaturePreview FeaturePreview

Slide 21

Slide 21 text

Full Application App Feature NetworkLive Common Feature Feature Network FeaturePreview FeaturePreview FeaturePreview

Slide 22

Slide 22 text

Feature Preview App Feature NetworkLive Common Feature Feature Network FeaturePreview FeaturePreview FeaturePreview

Slide 23

Slide 23 text

Demo

Slide 24

Slide 24 text

Takeways Previews are extremely powerful, start using them Separate interface/fakes + implementation in Gradle Having fast deployable features is AWESOME Long build times SUCK

Slide 25

Slide 25 text

How to apply this today? - Gradle structure works without Compose / Previews - Ralf Wondratschek — Android at Square - Start Creating Fakes - Preparing for Compose - Adam Bennet — Migrating your design system

Slide 26

Slide 26 text

Credits / Resources - Point-Free - Designing Dependencies - Modeled my talk after this series - Amazing resource - Attacking Build Times with Sample Apps - Bill Phillips @ Cash App - Demo Application Code - https:#//github.com/Rahkeen/Hail

Slide 27

Slide 27 text

Thanks @heyrikin