Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AppCraft: Faster Than a Speeding Release Train

AppCraft: Faster Than a Speeding Release Train

At Zalando, we have a fairly small engineering team behind our flagship mobile app, with a constant stream of great ideas coming from product owners. A three-week release train isn't always fast enough to deploy changes such as UI tweaks, new A/B tests, and partner campaigns. This limitation is exacerbated by the fact that many users don't install app updates immediately.

We first looked at React Native & CodePush as a way to deploy app updates more quickly. Spoiler alert: integrating React Native with an existing app is hard and you can't just wave a magic wand to turn any JavaScript engineer into a mobile developer.

Since last summer, we've been building AppCraft, the internal name for our server-driven UI platform. AppCraft rethinks the traditional mobile-client-meets-REST-API architecture by moving most of the malleable logic to the server, reducing the client to what is essentially a domain-specific browser. This enables rapid iteration on app features by non-technical business people; freeing up our mobile engineering resources for more strategic (and let's face it — more interesting) tasks.

How does this even work? What did we learn along the way? In this talk, Andy will tell you and show you.

Andy Dyer

May 22, 2019
Tweet

More Decks by Andy Dyer

Other Decks in Technology

Transcript

  1. Outline 1. The problem 2. Our solution 3. Mobile client

    architecture 4. Demo 5. Future plans & lessons learned 3
  2. Apps Don't Care •Layout variants - phone vs. tablet, country,

    A/B tests •Localization •Tracking & analytics 22
  3. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  4. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  5. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  6. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  7. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  8. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  9. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  10. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  11. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  12. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  13. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  14. Layout Response { "screen_id": "example-screen", "component": { "component_id": "root-component", "type":

    "layout", "children": [ { "component_id": "hello-text", "type": "text", "options": { "text": "Placeholder text" }, "style": { ... }, "events: [ ... ] } ] } } 25
  15. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  16. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  17. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  18. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  19. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  20. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  21. Data Response { "component": { "component_id": "root-component", "items": [ {

    "component_id": "hello-text", "options": { "text": "Hello, MobiusConf!" } } ] } } 26
  22. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  23. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  24. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  25. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  26. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  27. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  28. Litho: Component Example @LayoutSpec public object LithoComponentSpec { @OnCreateLayout fun

    onCreateLayout(c: ComponentContext): Component = Text.create(c) .text("Hello, MobiusConf!") .textSizeSp(40)) .build(); } 28
  29. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  30. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  31. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  32. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  33. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  34. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  35. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  36. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  37. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  38. Litho: Wrapping a Native View @MountSpec public object ColorComponentSpec {

    @OnCreateMountContent fun onCreateMountContent(Context c): ColorDrawable = ColorDrawable(); @OnMount fun onMount( context: ComponentContext, colorDrawable: ColorDrawable, @Prop colorName: String) { colorDrawable.color = Color.parseColor(colorName) } } 29
  39. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  40. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  41. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  42. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  43. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  44. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  45. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  46. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  47. Using a Litho Component fun createView(context: Context): View { val

    c = ComponentContext(context) val component = LithoComponent.create(c) .background( ColorComponent.create(c).colorName("blue") ) .build() return LithoView.create(c, component)) } 30
  48. Rendering a Screen 1. Layout API request 2. Render layout

    with placeholders and/or defaults 36
  49. Rendering a Screen 1. Layout API request 2. Render layout

    with placeholders and/or defaults 3. Data API request 36
  50. Rendering a Screen 1. Layout API request 2. Render layout

    with placeholders and/or defaults 3. Data API request 4. Rerender layout bound with data and events 36
  51. Rendering a Screen 1. Layout API request 2. Render layout

    with placeholders and/or defaults 3. Data API request 4. Rerender layout bound with data and events 5. Additional data requests, if necessary 36
  52. Testing & CI •Static analysis - code styles, lint, public

    API, etc. •Unit tests •Screenshot tests 38
  53. Testing & CI •Static analysis - code styles, lint, public

    API, etc. •Unit tests •Screenshot tests •End-to-end/integration tests 38
  54. Lessons Learned •The difference between a prototype and a production

    ready platform is immense. •Don’t cut corners. Paint both sides of the fence. YPGNI. 44
  55. Lessons Learned •The difference between a prototype and a production

    ready platform is immense. •Don’t cut corners. Paint both sides of the fence. YPGNI. •If something seems obvious but no one else is doing it, it’s either genius or foolish...maybe both. 44
  56. Lessons Learned (cont.) •A Redux/MVI architecture has a lot of

    advantages. •Pair programming really is as great as people say it is. 45