$30 off During Our Annual Pro Sale. View Details »

Presto - 10x Faster Mobile App Dev with PureScript

Vimal Kumar
September 08, 2017
6.1k

Presto - 10x Faster Mobile App Dev with PureScript

Vimal Kumar

September 08, 2017
Tweet

Transcript

  1. 10x Faster
    Mobile App Dev
    with PureScript
    Presto.

    View Slide

  2. ● Built large scale systems at Juspay, Amazon,
    Trilogy serving millions of users
    ● A convert to PureScript from Clojure / JavaScript
    ● Passionate about building Creation tools
    Hello!
    I’m Vimal Kumar, CEO of Juspay

    View Slide

  3. Why do commercial apps take months
    to develop and millions of $$ to
    maintain?
    PROBLEM

    View Slide

  4. Why are Apps hard?
    Unnatural programming model for
    Business Logic
    ● Event based model complicates transactional apps
    ● No clarity of flow of control - too many jumps
    ● Can’t compose flows, smaller to larger, due to async nature

    View Slide

  5. Why are Apps hard?
    Frameworks focus on Getting started quick;
    Not on fundamentals to Control complexity
    ● Complexity of serious apps is exponentially increasing.
    ● Need a strong theory like Functional Programming / Category
    theory with extreme focus on composition.
    ● Hard theories need years of investment to get practical advantage.

    View Slide

  6. Why are Apps hard?
    Fragmented Architecture, Need Unification
    ● Frontend, Backend, Persistence, External service integration,
    Analytics, Business Logic, Infrastructure.
    ● All are handled in different ways. They can be unified with a
    few simple building blocks.

    View Slide

  7. Presto’s vision is to enable
    Freshers/PMs build and maintain apps
    with 10x less time and effort.
    It needn’t be this way!

    View Slide

  8. How?
    ● Conversational UX DSL
    ● Business Flows as Goal Trees
    ● PureScript - Pure FP, Category Theory
    ● Unify, Only 3 Blocks, UI | Flows | Data

    View Slide

  9. UX Flows as Conversational DSL
    User System
    App
    Welcome
    Tell
    Ask
    Ask-Options
    Ask-Search
    Ask-Confirm
    Thank
    Delight
    Suggest
    Cross Sell
    Notify
    Fetch
    Detect
    Search
    Commit
    Track
    SetTimer
    Etc..
    App
    The App
    Weaves a.
    Conversation
    between User
    & System
    towards a
    Goal
    Goal

    View Slide

  10. Business Logic as Goal Trees
    ● Composable Goals!
    ● Understandable to
    non-tech - Designers,
    Product Managers
    Introduce Verify Mobile Create VPA Goal: BHIM Onboarding
    UI: Step 1 Help
    UI: Step 2 Help
    UI: Success
    OR
    Verify Mobile
    With OTP
    Verify Mobile
    Sending SMS
    API: Trigger OTP
    Poll SMS Inbox
    for OTP
    More steps
    Tree extends
    here…
    Local API: Send
    SMS Code
    Poll Server for
    SMS Code
    UI: Success
    More steps
    Tree extends
    here…
    More steps
    Tree extends
    here…
    UI: Welcome
    UI: Ask Mobile

    View Slide

  11. Welcome Dilip to the app
    Ask to pay the DTH bill (why not give some incentive!) >
    Ask to choose DTH Operator. If a lot, let him search >
    Ask for his Customer ID. Show HELP on where to find the Customer ID >
    Fetch his Customer Name and latest due bill amount :: LOAD >
    Show the bill details and Ask to pay
    SubFlow Collect_UPI_MPIN
    Commit the payment and Show confirmation status.
    Cross Sell Ask if he’d like to set up Auto-deduct OR Payment reminder for future bills >
    Thank Dilip.
    Goal Tree as a Narrative

    View Slide

  12. DSL Goal Tree - Code Walkthrough

    View Slide

  13. PureScript - Pure FP
    ● Composition, State Management, Conciseness and Clarity
    ● CPS (Continuation passing style) for the DSL Goal Trees
    ● Choice of PureScript - Best of Haskell and JavaScript.
    ● Category Theory - Functors / Monads / Applicatives

    View Slide

  14. Just 3 Building Blocks - Unify
    ● UI Structure - Visual Components like React
    ● Goal Tree - Flows as Pure Functions
    ○ Represents the entire business logic
    ○ Unified Backend and Frontend
    ● Data as Types
    ○ Single set of types for Frontend, Backend, UI, Storage
    ○ Types mapped to DB data model

    View Slide

  15. Why PureScript and CPS?
    LANGUAGE OPTIONS
    ARCHITECTURE OPTIONS
    PureScript GhcJS ClojureScript
    Haskell Like
    + Strong FP - Focus on Purity,
    Composition, Concise.
    + Types - Few errors, Easy refactoring
    JS Integration
    + Solid and easy JS FFI
    + JS Code Small & Reliable
    - New and evolving
    + Implements all Haskell’s
    features and access to most
    Haskell Libraries.
    - Large size JS and not so
    reliable runtime
    + Is a Lisp!
    + Strong Developer community
    + Proven runtime
    - Lacks Types
    - Lacks strong math / category
    theory foundation of Haskell
    CPS (Continuation Passing) Elm Architecture / Redux Pure FRP
    Maps directly to UX flows / flows as
    conversion funnel.
    Global state complicates
    transactional flows vs CPS manages
    local state in stack
    More general than CPS but
    complicates UX flows. Presto will add
    FRP support in future

    View Slide

  16. How is this 10X?
    ● Reuse of Lego Blocks: UI / Flow / Data components become
    extremely reusable across apps as we use Pure FP techniques.
    ● FP and Types guarantee Reliability for Free, minimizes testing.
    ● The DSL - Unifies Product / Dev and Design teams, improves
    clarity & removes communication overhead.
    ● Unified UI code for Android / iOS / Progressive Webapp / Desktop
    Web removes necessity for multiple UI dev teams
    ● Unified frontend / backend removes need for separate mobile and
    backend teams

    View Slide

  17. Apps in Production
    UPI SDK for top Apps UPI for Petroleum New Juspay Safe
    Potential for 100M+ users

    View Slide

  18. Next Steps
    School of Functional Programming

    View Slide

  19. Next Steps
    Visual Programming
    ● Auto generate UI components from design - Sketch plugin
    ● UX Goal Tree as an editable Fishbone diagram

    View Slide

  20. Thanks!
    Want to contribute? Just mail us at
    [email protected]

    View Slide