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

Gett Delivery - Breaking the State Machine

34f96d213c5e486f7d8493c3e4c7fb2b?s=47 Oren Kosto
January 30, 2019

Gett Delivery - Breaking the State Machine

Learn How Gett Delivery leveraged Firebase and RxSwift to break its state machine, creating an architecture suited for the delivery world.

34f96d213c5e486f7d8493c3e4c7fb2b?s=128

Oren Kosto

January 30, 2019
Tweet

Other Decks in Technology

Transcript

  1. Breaking the State Machine Oren Kosto

  2. About Myself • Oren Kosto ! • Embarrassing Husband/Dad •

    Communication Systems Engineer • Writing code for a living for the last 5 years $ • iOS & Web Developer @ Gett for 1 year • Multi-disciplinary, Generalist • First time speaking in a tech meetup... orenk86 oren.kosto oren-kosto
  3. Gett Growth • Expanding Gett's capabilities and services beyond the

    world of taxis • Developing additional products on top of Gett’s existing infrastructure
  4. What are we going to talk about? • Gett Delivery

    Reboot • (Breaking) State machines
  5. The “Traditional” Taxi Ride • On demand ride • Each

    passenger needs a dedicated driver • Deterministic process: • Order • Find a driver • Pickup • Drop Off • Charge • Built with state machines
  6. Gett Delivery • On Demand deliveries • Every Package needs

    a dedicated courier • Same deterministic process as a taxi • Built using Gett’s existing taxi infrastructure • Taxi ride state machine
  7. Gett Delivery - DaaS • Delivery As A Service •

    Same hour, same day, next day • Parcels are delivered from a depot to multiple drop-off points during the day • Higher paying multi-point future jobs for couriers • Same supply, much higher capacity
  8. Gett Delivery - DaaS • Delivery As A Service •

    Same hour, same day, next day • Parcels are delivered from a depot to multiple drop-off points during the day • Higher paying multi-point future jobs for couriers • Same supply, much higher capacity
  9. Journeys Optimization Overview Bundle Deliveries

  10. Challenges Optimistic UI Offline Functionality Changes On The Fly Process

    Not Deterministic Conflict Resolution Event Management Connectivity & Sync Recovery
  11. Building A New Product

  12. Delivery One-To-Many Driver Actions Shared Model, Realtime Flexible & Expandable

  13. Structure • Firebase Realtime Database & Cloud Functions • RxSwift:

    Firebase events wrapped in Observables • MVVM: View Model for every UI component - per action • Dependency Injection with Swinject • Protocol Oriented (action types, services) • (Almost) Stateless
  14. None
  15. Driver Action Protocols Exchangeable Action Contactable Action Mappable Action

  16. Return Driver Actions Flow Delivery Service Cloud Functions Realtime Database

    Drive Contact Deliver
  17. Implementation Map View Drive To Pickup VM Complete Action View

    MappableAction Presentable CompletableAction Presentable ContactableAction Presentable Call Recipient Component MappableAction ViewModeling CompletableAction ViewModeling ContactableAction ViewModeling Map View VM Complete Action VM Call Recipient VM Drive VC
  18. Implementation Firebase Service Driver Actions Service Analytics Manager Delivery Service

    GetTogether MultiPickup VM Delivery Collect VM Deliver VM Return VM Drive To Pickup VM Drive To Drop-Off VM
  19. Implementation Firebase Service Driver Actions Service Analytics Manager Delivery Service

    GetTogether MultiPickup VM Delivery Collect VM Deliver VM Return VM Drive To Pickup VM Drive To Drop-Off VM
  20. Our Experience • The Good • Firebase Realtime DB -

    Just works • Isolated the “problem” to one place, single source of truth • Extremely modular, highly reduced the cost of adding features • Minimized regression bugs • The Ugly • Firebase - Easy to abuse, expensive. Use it wisely • Multiple copies of the data on the server - must avoid conflicts • Hard learning curve, might seem like over-engineering at first • Cloud functions - hard to debug, hard to change, no version control
  21. Thank You! • Icons made by Freepik and SmashIcons from

    www.flaticon.com